diff options
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; } |