From b7d9dfc7ba4ae1ae9482eee62b1912b40dc64f42 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 7 Jun 2007 21:42:15 +0000 Subject: [PATCH] Use DominatorTree instead of ETForest. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37499 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 5c007551afb..bd7d1d92493 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -111,7 +111,7 @@ namespace { class VISIBILITY_HIDDEN LoopStrengthReduce : public LoopPass { LoopInfo *LI; - ETForest *EF; + DominatorTree *DT; ScalarEvolution *SE; const TargetData *TD; const Type *UIntPtrTy; @@ -156,13 +156,12 @@ namespace { // many analyses if they are around. AU.addPreservedID(LoopSimplifyID); AU.addPreserved(); - AU.addPreserved(); AU.addPreserved(); AU.addPreserved(); AU.addRequiredID(LoopSimplifyID); AU.addRequired(); - AU.addRequired(); + AU.addRequired(); AU.addRequired(); AU.addRequired(); } @@ -353,7 +352,7 @@ static bool getSCEVStartAndStride(const SCEVHandle &SH, Loop *L, /// the loop, resulting in reg-reg copies (if we use the pre-inc value when we /// should use the post-inc value). static bool IVUseShouldUsePostIncValue(Instruction *User, Instruction *IV, - Loop *L, ETForest *EF, Pass *P) { + Loop *L, DominatorTree *DT, Pass *P) { // If the user is in the loop, use the preinc value. if (L->contains(User->getParent())) return false; @@ -361,7 +360,7 @@ static bool IVUseShouldUsePostIncValue(Instruction *User, Instruction *IV, // Ok, the user is outside of the loop. If it is dominated by the latch // block, use the post-inc value. - if (EF->dominates(LatchBlock, User->getParent())) + if (DT->dominates(LatchBlock, User->getParent())) return true; // There is one case we have to be careful of: PHI nodes. These little guys @@ -378,7 +377,7 @@ static bool IVUseShouldUsePostIncValue(Instruction *User, Instruction *IV, for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) if (PN->getIncomingValue(i) == IV) { ++NumUses; - if (!EF->dominates(LatchBlock, PN->getIncomingBlock(i))) + if (!DT->dominates(LatchBlock, PN->getIncomingBlock(i))) return false; } @@ -456,7 +455,7 @@ bool LoopStrengthReduce::AddUsersIfInteresting(Instruction *I, Loop *L, // Okay, we found a user that we cannot reduce. Analyze the instruction // and decide what to do with it. If we are a use inside of the loop, use // the value before incrementation, otherwise use it after incrementation. - if (IVUseShouldUsePostIncValue(User, I, L, EF, this)) { + if (IVUseShouldUsePostIncValue(User, I, L, DT, this)) { // The value used will be incremented by the stride more than we are // expecting, so subtract this off. SCEVHandle NewStart = SCEV::getMinusSCEV(Start, Stride); @@ -1400,7 +1399,7 @@ namespace { bool LoopStrengthReduce::runOnLoop(Loop *L, LPPassManager &LPM) { LI = &getAnalysis(); - EF = &getAnalysis(); + DT = &getAnalysis(); SE = &getAnalysis(); TD = &getAnalysis(); UIntPtrTy = TD->getIntPtrType();