diff options
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LICM.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index 695eaf6cf4a..5ebf035bf51 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -809,14 +809,15 @@ bool llvm::hoistRegion(DomTreeNode *N, AliasAnalysis *AA, LoopInfo *LI, [&](Use &U) { return DT->dominates(I, U); })) { BasicBlock *Dominator = DT->getNode(I->getParent())->getIDom()->getBlock(); - LLVM_DEBUG(dbgs() << "LICM rehoisting to " << Dominator->getName() - << ": " << *I << "\n"); - if (!HoistPoint || HoistPoint->getParent() != Dominator) { + if (!HoistPoint || !DT->dominates(HoistPoint->getParent(), Dominator)) { if (HoistPoint) assert(DT->dominates(Dominator, HoistPoint->getParent()) && "New hoist point expected to dominate old hoist point"); HoistPoint = Dominator->getTerminator(); } + LLVM_DEBUG(dbgs() << "LICM rehoisting to " + << HoistPoint->getParent()->getName() + << ": " << *I << "\n"); moveInstructionBefore(*I, *HoistPoint, *SafetyInfo); HoistPoint = I; Changed = true; |

