diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-29 17:28:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-29 17:28:22 +0000 |
commit | 40700fe6836c808789d1fe5cc6bcccce86d5c62b (patch) | |
tree | 71ca04c759392cd1ad096f0cd22dc0136bbad30f /lib | |
parent | 68608e4dd0a7b48f1d1270c34e538bf5922336ac (diff) |
don't eliminate load from volatile value on paths where the load is dead.
This fixes the second half of PR2262
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50430 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 86aca073ab..82c67d03d9 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -9396,6 +9396,15 @@ Instruction *InstCombiner::FoldPHIArgOpIntoPHI(PHINode &PN) { LI->getParent() != PN.getIncomingBlock(i) || !isSafeToSinkLoad(LI)) return 0; + + // If the PHI is volatile and its block has multiple successors, sinking + // it would remove a load of the volatile value from the path through the + // other successor. + if (isVolatile && + LI->getParent()->getTerminator()->getNumSuccessors() != 1) + return 0; + + } else if (I->getOperand(1) != ConstantOp) { return 0; } |