diff options
author | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2016-02-21 16:36:00 +0000 |
---|---|---|
committer | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2016-02-21 16:36:00 +0000 |
commit | 85b04dedf4f7855bc48c3a83edac08a65a408531 (patch) | |
tree | d10e115f5802bb62cba2ed0351cdf7aa9cdfdd70 /polly/lib/Support/ScopHelper.cpp | |
parent | 2b809d13906ad0191365b4b71b3fb18901ac437d (diff) | |
download | bcm5719-llvm-85b04dedf4f7855bc48c3a83edac08a65a408531.tar.gz bcm5719-llvm-85b04dedf4f7855bc48c3a83edac08a65a408531.zip |
[FIX] Compare SCEVs not values during SCEV expansion
This fixes a compile time bug in SPEC2006 403.gcc, namely an endless
recursion in the ScopExpander::visitUnknown function.
llvm-svn: 261474
Diffstat (limited to 'polly/lib/Support/ScopHelper.cpp')
-rw-r--r-- | polly/lib/Support/ScopHelper.cpp | 13 |
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 && |