summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/IndVarSimplify.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/IndVarSimplify.cpp19
1 files changed, 1 insertions, 18 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index e2c2ff2e230..372ea61c159 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -152,9 +152,6 @@ class IndVarSimplify {
void sinkUnusedInvariants(Loop *L);
- Value *expandSCEVIfNeeded(SCEVExpander &Rewriter, const SCEV *S, Loop *L,
- Instruction *InsertPt, Type *Ty);
-
public:
IndVarSimplify(LoopInfo *LI, ScalarEvolution *SE, DominatorTree *DT,
const DataLayout &DL, TargetLibraryInfo *TLI,
@@ -521,19 +518,6 @@ struct RewritePhi {
} // end anonymous namespace
-Value *IndVarSimplify::expandSCEVIfNeeded(SCEVExpander &Rewriter, const SCEV *S,
- Loop *L, Instruction *InsertPt,
- Type *ResultTy) {
- // Before expanding S into an expensive LLVM expression, see if we can use an
- // already existing value as the expansion for S.
- if (Value *ExistingValue = Rewriter.getExactExistingExpansion(S, InsertPt, L))
- if (ExistingValue->getType() == ResultTy)
- return ExistingValue;
-
- // We didn't find anything, fall back to using SCEVExpander.
- return Rewriter.expandCodeFor(S, ResultTy, InsertPt);
-}
-
//===----------------------------------------------------------------------===//
// rewriteLoopExitValues - Optimize IV users outside the loop.
// As a side effect, reduces the amount of IV processing within the loop.
@@ -650,8 +634,7 @@ void IndVarSimplify::rewriteLoopExitValues(Loop *L, SCEVExpander &Rewriter) {
}
bool HighCost = Rewriter.isHighCostExpansion(ExitValue, L, Inst);
- Value *ExitVal =
- expandSCEVIfNeeded(Rewriter, ExitValue, L, Inst, PN->getType());
+ Value *ExitVal = Rewriter.expandCodeFor(ExitValue, PN->getType(), Inst);
LLVM_DEBUG(dbgs() << "INDVARS: RLEV: AfterLoopVal = " << *ExitVal
<< '\n'
OpenPOWER on IntegriCloud