Skip to content

Commit

Permalink
[InstCombine] Fix a code-sinking bug after D73832/f1a9efabcb9b
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
MaskRay committed Mar 26, 2020
1 parent d264f02 commit 4c52d51
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Expand Up @@ -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();

Expand Down

0 comments on commit 4c52d51

Please sign in to comment.