Index: llvm/include/llvm/Analysis/LoopUnrollAnalyzer.h =================================================================== --- llvm/include/llvm/Analysis/LoopUnrollAnalyzer.h +++ llvm/include/llvm/Analysis/LoopUnrollAnalyzer.h @@ -69,7 +69,7 @@ /// SCEV expression corresponding to number of currently simulated /// iteration. - const SCEV *IterationNumber; + const SCEVConstant *IterationNumber; /// While we walk the loop instructions, we build up and maintain a mapping /// of simplified values specific to this iteration. The idea is to propagate Index: llvm/include/llvm/Analysis/ScalarEvolution.h =================================================================== --- llvm/include/llvm/Analysis/ScalarEvolution.h +++ llvm/include/llvm/Analysis/ScalarEvolution.h @@ -60,6 +60,7 @@ class raw_ostream; class ScalarEvolution; class SCEVAddRecExpr; +class SCEVConstant; class SCEVUnknown; class StructType; class TargetLibraryInfo; @@ -560,9 +561,9 @@ /// expression. const SCEV *getSCEV(Value *V); - const SCEV *getConstant(ConstantInt *V); - const SCEV *getConstant(const APInt &Val); - const SCEV *getConstant(Type *Ty, uint64_t V, bool isSigned = false); + const SCEVConstant *getConstant(ConstantInt *V); + const SCEVConstant *getConstant(const APInt &Val); + const SCEVConstant *getConstant(Type *Ty, uint64_t V, bool isSigned = false); const SCEV *getLosslessPtrToIntExpr(const SCEV *Op, unsigned Depth = 0); const SCEV *getPtrToIntExpr(const SCEV *Op, Type *Ty); const SCEV *getTruncateExpr(const SCEV *Op, Type *Ty, unsigned Depth = 0); @@ -650,19 +651,19 @@ const SCEV *getCouldNotCompute(); /// Return a SCEV for the constant 0 of a specific type. - const SCEV *getZero(Type *Ty) { return getConstant(Ty, 0); } + const SCEVConstant *getZero(Type *Ty) { return getConstant(Ty, 0); } /// Return a SCEV for the constant 1 of a specific type. - const SCEV *getOne(Type *Ty) { return getConstant(Ty, 1); } + const SCEVConstant *getOne(Type *Ty) { return getConstant(Ty, 1); } /// Return a SCEV for the constant \p Power of two. - const SCEV *getPowerOfTwo(Type *Ty, unsigned Power) { + const SCEVConstant *getPowerOfTwo(Type *Ty, unsigned Power) { assert(Power < getTypeSizeInBits(Ty) && "Power out of range"); return getConstant(APInt::getOneBitSet(getTypeSizeInBits(Ty), Power)); } /// Return a SCEV for the constant -1 of a specific type. - const SCEV *getMinusOne(Type *Ty) { + const SCEVConstant *getMinusOne(Type *Ty) { return getConstant(Ty, -1, /*isSigned=*/true); } Index: llvm/lib/Analysis/ScalarEvolution.cpp =================================================================== --- llvm/lib/Analysis/ScalarEvolution.cpp +++ llvm/lib/Analysis/ScalarEvolution.cpp @@ -480,23 +480,25 @@ return S->getSCEVType() == scCouldNotCompute; } -const SCEV *ScalarEvolution::getConstant(ConstantInt *V) { +const SCEVConstant *ScalarEvolution::getConstant(ConstantInt *V) { FoldingSetNodeID ID; ID.AddInteger(scConstant); ID.AddPointer(V); void *IP = nullptr; - if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; - SCEV *S = new (SCEVAllocator) SCEVConstant(ID.Intern(SCEVAllocator), V); + if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) + return cast(S); + SCEVConstant *S = + new (SCEVAllocator) SCEVConstant(ID.Intern(SCEVAllocator), V); UniqueSCEVs.InsertNode(S, IP); return S; } -const SCEV *ScalarEvolution::getConstant(const APInt &Val) { +const SCEVConstant *ScalarEvolution::getConstant(const APInt &Val) { return getConstant(ConstantInt::get(getContext(), Val)); } -const SCEV * -ScalarEvolution::getConstant(Type *Ty, uint64_t V, bool isSigned) { +const SCEVConstant *ScalarEvolution::getConstant(Type *Ty, uint64_t V, + bool isSigned) { IntegerType *ITy = cast(getEffectiveSCEVType(Ty)); return getConstant(ConstantInt::get(ITy, V, isSigned)); } Index: llvm/lib/Analysis/StackSafetyAnalysis.cpp =================================================================== --- llvm/lib/Analysis/StackSafetyAnalysis.cpp +++ llvm/lib/Analysis/StackSafetyAnalysis.cpp @@ -15,6 +15,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/ModuleSummaryAnalysis.h" #include "llvm/Analysis/ScalarEvolution.h" +#include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "llvm/Analysis/StackLifetime.h" #include "llvm/IR/ConstantRange.h" #include "llvm/IR/DerivedTypes.h" Index: llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp =================================================================== --- llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp +++ llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp @@ -60,6 +60,7 @@ #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Analysis/ScalarEvolution.h" +#include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/Constants.h" Index: llvm/unittests/Analysis/DDGTest.cpp =================================================================== --- llvm/unittests/Analysis/DDGTest.cpp +++ llvm/unittests/Analysis/DDGTest.cpp @@ -12,6 +12,7 @@ #include "llvm/Analysis/BasicAliasAnalysis.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/ScalarEvolution.h" +#include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/AsmParser/Parser.h" #include "llvm/IR/Dominators.h"