diff options
Diffstat (limited to 'polly/lib/Support/SCEVValidator.cpp')
-rw-r--r-- | polly/lib/Support/SCEVValidator.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/polly/lib/Support/SCEVValidator.cpp b/polly/lib/Support/SCEVValidator.cpp index 0e159f42993..1941875d0d5 100644 --- a/polly/lib/Support/SCEVValidator.cpp +++ b/polly/lib/Support/SCEVValidator.cpp @@ -429,6 +429,34 @@ public: } }; +class SCEVHasIVParams { + bool HasIVParams = false; + +public: + SCEVHasIVParams() {} + + bool follow(const SCEV *S) { + const SCEVUnknown *Unknown = dyn_cast<SCEVUnknown>(S); + if (!Unknown) + return true; + + CallInst *Call = dyn_cast<CallInst>(Unknown->getValue()); + + if (!Call) + return true; + + if (isConstCall(Call)) { + HasIVParams = true; + return false; + } + + return true; + } + + bool isDone() { return HasIVParams; } + bool hasIVParams() { return HasIVParams; } +}; + /// Check whether a SCEV refers to an SSA name defined inside a region. class SCEVInRegionDependences { const Region *R; @@ -542,6 +570,13 @@ void findValues(const SCEV *Expr, ScalarEvolution &SE, ST.visitAll(Expr); } +bool hasIVParams(const SCEV *Expr) { + SCEVHasIVParams HasIVParams; + SCEVTraversal<SCEVHasIVParams> ST(HasIVParams); + ST.visitAll(Expr); + return HasIVParams.hasIVParams(); +} + bool hasScalarDepsInsideRegion(const SCEV *Expr, const Region *R, llvm::Loop *Scope, bool AllowLoops) { SCEVInRegionDependences InRegionDeps(R, Scope, AllowLoops); |