From 6912e3b3821a5862293075357a2e7f352a7544a8 Mon Sep 17 00:00:00 2001 From: Silviu Baranga Date: Mon, 26 Oct 2015 13:50:06 +0000 Subject: [PATCH] [SCEV] Fix issues found during the review of r251283. NFC. Summary: Replace (const SCEVAddRecExpr *) with cast. Rename SCEVApplyRewriter to SCEVLoopAddRecRewriter (which is a more appropriate name) since the description is "takes a scalar evolution expression and applies the Map (Loop -> SCEV) to all AddRecExprs." Subscribers: llvm-commits, sanjoy Differential Revision: http://reviews.llvm.org/D14065 llvm-svn: 251292 --- .../llvm/Analysis/ScalarEvolutionExpressions.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/include/llvm/Analysis/ScalarEvolutionExpressions.h b/include/llvm/Analysis/ScalarEvolutionExpressions.h index 3d9522773bc..b55ba22a634 100644 --- a/include/llvm/Analysis/ScalarEvolutionExpressions.h +++ b/include/llvm/Analysis/ScalarEvolutionExpressions.h @@ -664,18 +664,19 @@ namespace llvm { typedef DenseMap LoopToScevMapT; - /// The SCEVApplyRewriter takes a scalar evolution expression and applies + /// The SCEVLoopAddRecRewriter takes a scalar evolution expression and applies /// the Map (Loop -> SCEV) to all AddRecExprs. - class SCEVApplyRewriter : public SCEVRewriteVisitor { + class SCEVLoopAddRecRewriter + : public SCEVRewriteVisitor { public: static const SCEV *rewrite(const SCEV *Scev, LoopToScevMapT &Map, ScalarEvolution &SE) { - SCEVApplyRewriter Rewriter(SE, Map); + SCEVLoopAddRecRewriter Rewriter(SE, Map); return Rewriter.visit(Scev); } - SCEVApplyRewriter(ScalarEvolution &SE, LoopToScevMapT &M) - : SCEVRewriteVisitor(SE), Map(M) {} + SCEVLoopAddRecRewriter(ScalarEvolution &SE, LoopToScevMapT &M) + : SCEVRewriteVisitor(SE), Map(M) {} const SCEV *visitAddRecExpr(const SCEVAddRecExpr *Expr) { SmallVector Operands; @@ -688,7 +689,7 @@ namespace llvm { if (0 == Map.count(L)) return Res; - const SCEVAddRecExpr *Rec = (const SCEVAddRecExpr *) Res; + const SCEVAddRecExpr *Rec = cast(Res); return Rec->evaluateAtIteration(Map[L], SE); } @@ -699,7 +700,7 @@ namespace llvm { /// Applies the Map (Loop -> SCEV) to the given Scev. static inline const SCEV *apply(const SCEV *Scev, LoopToScevMapT &Map, ScalarEvolution &SE) { - return SCEVApplyRewriter::rewrite(Scev, Map, SE); + return SCEVLoopAddRecRewriter::rewrite(Scev, Map, SE); } }