mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-13 08:26:02 +00:00
Simplify this code. Don't do a DomTreeNode lookup for each visited block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104267 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3091,17 +3091,6 @@ void LSRInstance::Solve(SmallVectorImpl<const Formula *> &Solution) const {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getImmediateDominator - A handy utility for the specific DominatorTree
|
|
||||||
/// query that we need here.
|
|
||||||
///
|
|
||||||
static BasicBlock *getImmediateDominator(BasicBlock *BB, DominatorTree &DT) {
|
|
||||||
DomTreeNode *Node = DT.getNode(BB);
|
|
||||||
if (!Node) return 0;
|
|
||||||
Node = Node->getIDom();
|
|
||||||
if (!Node) return 0;
|
|
||||||
return Node->getBlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// HoistInsertPosition - Helper for AdjustInsertPositionForExpand. Climb up
|
/// HoistInsertPosition - Helper for AdjustInsertPositionForExpand. Climb up
|
||||||
/// the dominator tree far as we can go while still being dominated by the
|
/// the dominator tree far as we can go while still being dominated by the
|
||||||
/// input positions. This helps canonicalize the insert position, which
|
/// input positions. This helps canonicalize the insert position, which
|
||||||
@@ -3115,9 +3104,11 @@ LSRInstance::HoistInsertPosition(BasicBlock::iterator IP,
|
|||||||
unsigned IPLoopDepth = IPLoop ? IPLoop->getLoopDepth() : 0;
|
unsigned IPLoopDepth = IPLoop ? IPLoop->getLoopDepth() : 0;
|
||||||
|
|
||||||
BasicBlock *IDom;
|
BasicBlock *IDom;
|
||||||
for (BasicBlock *Rung = IP->getParent(); ; Rung = IDom) {
|
for (DomTreeNode *Rung = DT.getNode(IP->getParent()); ; ) {
|
||||||
IDom = getImmediateDominator(Rung, DT);
|
assert(Rung && "Block has no DomTreeNode!");
|
||||||
if (!IDom) return IP;
|
Rung = Rung->getIDom();
|
||||||
|
if (!Rung) return IP;
|
||||||
|
IDom = Rung->getBlock();
|
||||||
|
|
||||||
// Don't climb into a loop though.
|
// Don't climb into a loop though.
|
||||||
const Loop *IDomLoop = LI.getLoopFor(IDom);
|
const Loop *IDomLoop = LI.getLoopFor(IDom);
|
||||||
|
Reference in New Issue
Block a user