mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 23:29:20 +00:00
Fix PR2496, a really nasty bug which involved sinking volatile loads
into phis. This is actually the same bug as PR2262 / 2008-04-29-VolatileLoadDontMerge.ll, but I missed checking the first predecessor for multiple successors. Testcase here: InstCombine/2008-07-08-VolatileLoadMerge.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53240 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
895860e27b
commit
710429645a
@ -9354,6 +9354,14 @@ Instruction *InstCombiner::FoldPHIArgOpIntoPHI(PHINode &PN) {
|
||||
if (LI->getParent() != PN.getIncomingBlock(0) ||
|
||||
!isSafeToSinkLoad(LI))
|
||||
return 0;
|
||||
|
||||
// If the PHI is of volatile loads and the load 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 (isa<GetElementPtrInst>(FirstInst)) {
|
||||
if (FirstInst->getNumOperands() == 2)
|
||||
return FoldPHIArgBinOpIntoPHI(PN);
|
||||
@ -9380,9 +9388,9 @@ Instruction *InstCombiner::FoldPHIArgOpIntoPHI(PHINode &PN) {
|
||||
!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 the PHI is of volatile loads and the load 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user