Use more const qualifiers with SCEV interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69450 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 01c9574..42fb9b9 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -98,7 +98,7 @@
BasicBlock *ExitingBlock,
BranchInst *BI,
SCEVExpander &Rewriter);
- void RewriteLoopExitValues(Loop *L, SCEV *BackedgeTakenCount);
+ void RewriteLoopExitValues(Loop *L, const SCEV *BackedgeTakenCount);
void DeleteTriviallyDeadInstructions(SmallPtrSet<Instruction*, 16> &Insts);
@@ -211,7 +211,8 @@
/// final value of any expressions that are recurrent in the loop, and
/// substitute the exit values from the loop into any instructions outside of
/// the loop that use the final values of the current expressions.
-void IndVarSimplify::RewriteLoopExitValues(Loop *L, SCEV *BackedgeTakenCount) {
+void IndVarSimplify::RewriteLoopExitValues(Loop *L,
+ const SCEV *BackedgeTakenCount) {
BasicBlock *Preheader = L->getLoopPreheader();
// Scan all of the instructions in the loop, looking at those that have
@@ -627,7 +628,7 @@
// polynomial evaluations inside of the loop, and the str reduction pass
// currently can only reduce affine polynomials. For now just disable
// indvar subst on anything more complex than an affine addrec.
- if (SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(SCEV))
+ if (const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(SCEV))
if (AR->getLoop() == L && AR->isAffine())
IndVars.push_back(std::make_pair(PN, SCEV));
}
@@ -716,7 +717,7 @@
// variable.
while (!IndVars.empty()) {
PHINode *PN = IndVars.back().first;
- SCEVAddRecExpr *AR = cast<SCEVAddRecExpr>(IndVars.back().second);
+ const SCEVAddRecExpr *AR = cast<SCEVAddRecExpr>(IndVars.back().second);
Value *NewVal = Rewriter.expandCodeFor(AR, PN->getType(), InsertPt);
DOUT << "INDVARS: Rewrote IV '" << *AR << "' " << *PN
<< " into = " << *NewVal << "\n";