From bddb7f82103deb226baa6793f41c5961661167e7 Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Wed, 10 Aug 2011 04:22:26 +0000 Subject: [PATCH] Cleanup. Make ScalarEvolution an explicit argument of the SimplifyIndVar utility since it is required. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137202 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Transforms/Utils/SimplifyIndVar.h | 6 +++--- lib/Transforms/Scalar/IndVarSimplify.cpp | 4 ++-- lib/Transforms/Utils/SimplifyIndVar.cpp | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/llvm/Transforms/Utils/SimplifyIndVar.h b/include/llvm/Transforms/Utils/SimplifyIndVar.h index 46e4aaffc78..524cf5ad979 100644 --- a/include/llvm/Transforms/Utils/SimplifyIndVar.h +++ b/include/llvm/Transforms/Utils/SimplifyIndVar.h @@ -39,18 +39,18 @@ public: /// simplifyUsersOfIV - Simplify instructions that use this induction variable /// by using ScalarEvolution to analyze the IV's recurrence. -bool simplifyUsersOfIV(PHINode *CurrIV, LPPassManager *LPM, +bool simplifyUsersOfIV(PHINode *CurrIV, ScalarEvolution *SE, LPPassManager *LPM, SmallVectorImpl &Dead, IVVisitor *V = NULL); /// SimplifyLoopIVs - Simplify users of induction variables within this /// loop. This does not actually change or add IVs. -bool simplifyLoopIVs(Loop *L, LPPassManager *LPM, +bool simplifyLoopIVs(Loop *L, ScalarEvolution *SE, LPPassManager *LPM, SmallVectorImpl &Dead); /// simplifyIVUsers - Simplify instructions recorded by the IVUsers pass. /// This is a legacy implementation to reproduce the behavior of the /// IndVarSimplify pass prior to DisableIVRewrite. -bool simplifyIVUsers(IVUsers *IU, LPPassManager *LPM, +bool simplifyIVUsers(IVUsers *IU, ScalarEvolution *SE, LPPassManager *LPM, SmallVectorImpl &Dead); } // namespace llvm diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index 14f995bec26..4cbc9d9c459 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -1192,7 +1192,7 @@ void IndVarSimplify::SimplifyAndExtend(Loop *L, // Information about sign/zero extensions of CurrIV. WideIVVisitor WIV(SE, TD); - Changed |= simplifyUsersOfIV(CurrIV, &LPM, DeadInsts, &WIV); + Changed |= simplifyUsersOfIV(CurrIV, SE, &LPM, DeadInsts, &WIV); if (WIV.WI.WidestNativeType) { WideIVMap[CurrIV] = WIV.WI; @@ -1831,7 +1831,7 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) { // Eliminate redundant IV users. if (!DisableIVRewrite) - Changed |= simplifyIVUsers(IU, &LPM, DeadInsts); + Changed |= simplifyIVUsers(IU, SE, &LPM, DeadInsts); // Eliminate redundant IV cycles. if (DisableIVRewrite) diff --git a/lib/Transforms/Utils/SimplifyIndVar.cpp b/lib/Transforms/Utils/SimplifyIndVar.cpp index be6a1e0019d..0cf372a53f3 100644 --- a/lib/Transforms/Utils/SimplifyIndVar.cpp +++ b/lib/Transforms/Utils/SimplifyIndVar.cpp @@ -54,16 +54,16 @@ namespace { bool Changed; public: - SimplifyIndvar(Loop *Loop, LPPassManager *LPM, + SimplifyIndvar(Loop *Loop, ScalarEvolution *SE, LPPassManager *LPM, SmallVectorImpl &Dead, IVUsers *IVU = NULL) : L(Loop), LI(LPM->getAnalysisIfAvailable()), - SE(LPM->getAnalysisIfAvailable()), + SE(SE), IU(IVU), TD(LPM->getAnalysisIfAvailable()), DeadInsts(Dead), Changed(false) { - assert(LI && SE && "IV simplification requires ScalarEvolution"); + assert(LI && "IV simplification requires LoopInfo"); } bool hasChanged() const { return Changed; } @@ -372,22 +372,22 @@ namespace llvm { /// simplifyUsersOfIV - Simplify instructions that use this induction variable /// by using ScalarEvolution to analyze the IV's recurrence. -bool simplifyUsersOfIV(PHINode *CurrIV, LPPassManager *LPM, +bool simplifyUsersOfIV(PHINode *CurrIV, ScalarEvolution *SE, LPPassManager *LPM, SmallVectorImpl &Dead, IVVisitor *V) { LoopInfo *LI = &LPM->getAnalysis(); - SimplifyIndvar SIV(LI->getLoopFor(CurrIV->getParent()), LPM, Dead); + SimplifyIndvar SIV(LI->getLoopFor(CurrIV->getParent()), SE, LPM, Dead); SIV.simplifyUsers(CurrIV, V); return SIV.hasChanged(); } /// simplifyLoopIVs - Simplify users of induction variables within this /// loop. This does not actually change or add IVs. -bool simplifyLoopIVs(Loop *L, LPPassManager *LPM, +bool simplifyLoopIVs(Loop *L, ScalarEvolution *SE, LPPassManager *LPM, SmallVectorImpl &Dead) { bool Changed = false; for (BasicBlock::iterator I = L->getHeader()->begin(); isa(I); ++I) { - Changed |= simplifyUsersOfIV(cast(I), LPM, Dead); + Changed |= simplifyUsersOfIV(cast(I), SE, LPM, Dead); } return Changed; } @@ -397,9 +397,9 @@ bool simplifyLoopIVs(Loop *L, LPPassManager *LPM, /// /// This is the old approach to IV simplification to be replaced by /// SimplifyLoopIVs. -bool simplifyIVUsers(IVUsers *IU, LPPassManager *LPM, +bool simplifyIVUsers(IVUsers *IU, ScalarEvolution *SE, LPPassManager *LPM, SmallVectorImpl &Dead) { - SimplifyIndvar SIV(IU->getLoop(), LPM, Dead); + SimplifyIndvar SIV(IU->getLoop(), SE, LPM, Dead); // Each round of simplification involves a round of eliminating operations // followed by a round of widening IVs. A single IVUsers worklist is used -- 2.34.1