From 2e101cca690645d63ae4de1eb7b0e11d322448fd Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 30 May 2022 15:37:46 +0200 Subject: [Local] Don't remove invoke of non-willreturn function The code was only checking for memory side-effects, but not for divergence side-effects. Replace this with a generic check. --- llvm/lib/Transforms/Utils/Local.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/Utils/Local.cpp') diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 5e37f38..a060975 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -2366,7 +2366,7 @@ static bool markAliveBlocks(Function &F, Changed = true; } if (II->doesNotThrow() && canSimplifyInvokeNoUnwind(&F)) { - if (II->use_empty() && II->onlyReadsMemory()) { + if (II->use_empty() && !II->mayHaveSideEffects()) { // jump to the normal destination branch. BasicBlock *NormalDestBB = II->getNormalDest(); BasicBlock *UnwindDestBB = II->getUnwindDest(); -- cgit v1.1