[llvm] 4c52d51 - [InstCombine] Fix a code-sinking bug after D73832/f1a9efabcb9b
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 25 22:51:41 PDT 2020
Author: Fangrui Song
Date: 2020-03-25T22:50:53-07:00
New Revision: 4c52d51e784ca7603969f2a664e5430d41b9d5dc
URL: https://github.com/llvm/llvm-project/commit/4c52d51e784ca7603969f2a664e5430d41b9d5dc
DIFF: https://github.com/llvm/llvm-project/commit/4c52d51e784ca7603969f2a664e5430d41b9d5dc.diff
LOG: [InstCombine] Fix a code-sinking bug after D73832/f1a9efabcb9b
- UserParent = PN->getIncomingBlock(*I->use_begin());
+ UserParent = PN->getIncomingBlock(*SingleUse);
The first use of I may be droppable (llvm.assume).
When compiling llvm/lib/IR/AutoUpgrade.cpp with a bootstrapped clang
with ThinLTO with minimized bitcode files, I see such a case in
the function _ZN4llvm20UpgradeIntrinsicCallEPNS_8CallInstEPNS_8FunctionE
clang -c -fthinlto-index=AutoUpgrade.o.thinlto.bc AutoUpgrade.bc -O3
Unfortunately it is really difficult to get a minimized reproduce.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index b62f19eeed64..f2bc6968c3e8 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -3505,7 +3505,7 @@ bool InstCombiner::run() {
// Get the block the use occurs in.
if (PHINode *PN = dyn_cast<PHINode>(UserInst))
- UserParent = PN->getIncomingBlock(*I->use_begin());
+ UserParent = PN->getIncomingBlock(*SingleUse);
else
UserParent = UserInst->getParent();
More information about the llvm-commits
mailing list