diff options
| author | Dan Gohman <gohman@apple.com> | 2010-05-20 20:00:25 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2010-05-20 20:00:25 +0000 |
| commit | d974a0e9d682e627f100340a8021e02ca991f965 (patch) | |
| tree | 95d12256e74bd454189813358c5d498e5e928668 /lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
| parent | ee43286ca9b6ae68d3419e23e51925cd1a6808aa (diff) | |
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
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
| -rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 968c3067f9..3c94616fe9 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -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 /// the dominator tree far as we can go while still being dominated by the /// input positions. This helps canonicalize the insert position, which @@ -3115,9 +3104,11 @@ LSRInstance::HoistInsertPosition(BasicBlock::iterator IP, unsigned IPLoopDepth = IPLoop ? IPLoop->getLoopDepth() : 0; BasicBlock *IDom; - for (BasicBlock *Rung = IP->getParent(); ; Rung = IDom) { - IDom = getImmediateDominator(Rung, DT); - if (!IDom) return IP; + for (DomTreeNode *Rung = DT.getNode(IP->getParent()); ; ) { + assert(Rung && "Block has no DomTreeNode!"); + Rung = Rung->getIDom(); + if (!Rung) return IP; + IDom = Rung->getBlock(); // Don't climb into a loop though. const Loop *IDomLoop = LI.getLoopFor(IDom); |
