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 | d9e3b5c5bd422254813a71990832ea9f83795a22 (patch) | |
tree | d3a02469a63431f1eb64a4bfda9c7f93cb153259 /llvm/lib/Transforms | |
parent | 53bcf3609af832191b277a5cf5610d344be2ca73 (diff) | |
download | bcm5719-llvm-d9e3b5c5bd422254813a71990832ea9f83795a22.tar.gz bcm5719-llvm-d9e3b5c5bd422254813a71990832ea9f83795a22.zip |
don't eliminate load from volatile value on paths where the load is dead.
This fixes the second half of PR2262
llvm-svn: 50430
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 86aca073abc..82c67d03d93 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/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; } |