summaryrefslogtreecommitdiffstats
path: root/polly/lib/Support/ScopHelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'polly/lib/Support/ScopHelper.cpp')
-rw-r--r--polly/lib/Support/ScopHelper.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/polly/lib/Support/ScopHelper.cpp b/polly/lib/Support/ScopHelper.cpp
index 63f91b81e13..f845be82dca 100644
--- a/polly/lib/Support/ScopHelper.cpp
+++ b/polly/lib/Support/ScopHelper.cpp
@@ -249,10 +249,15 @@ private:
const SCEV *visitUnknown(const SCEVUnknown *E) {
// If a value mapping was given try if the underlying value is remapped.
- if (VMap)
- if (Value *NewVal = VMap->lookup(E->getValue()))
- if (NewVal != E->getValue())
- return visit(SE.getSCEV(NewVal));
+ Value *NewVal = VMap ? VMap->lookup(E->getValue()) : nullptr;
+ if (NewVal) {
+ auto *NewE = SE.getSCEV(NewVal);
+
+ // While the mapped value might be different the SCEV representation might
+ // not be. To this end we will check before we go into recursion here.
+ if (E != NewE)
+ return visit(NewE);
+ }
Instruction *Inst = dyn_cast<Instruction>(E->getValue());
if (!Inst || (Inst->getOpcode() != Instruction::SRem &&
OpenPOWER on IntegriCloud