summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-10-26 15:32:57 +0000
committerDan Gohman <gohman@apple.com>2009-10-26 15:32:57 +0000
commitd632f89596f77e0df731280adedf3ac7e8fd1d4f (patch)
treeacabf75e8fbc678fa3f1735d6acf2f05fda2c732 /llvm/lib/Transforms
parent4302824fe26039e00cf48da39f1c799d3c1de368 (diff)
downloadbcm5719-llvm-d632f89596f77e0df731280adedf3ac7e8fd1d4f.tar.gz
bcm5719-llvm-d632f89596f77e0df731280adedf3ac7e8fd1d4f.zip
Make LSR's OptimizeShadowIV ignore induction variables with negative
strides for now, because it doesn't handle them correctly. This fixes a miscompile of SingleSource/Benchmarks/Misc-C++/ray. This problem was usually hidden because indvars transforms such induction variables into negations of canonical induction variables. llvm-svn: 85118
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 4c305aae832..e20fb16fb16 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -2262,6 +2262,10 @@ void LoopStrengthReduce::OptimizeShadowIV(Loop *L) {
if (!C) continue;
+ // Ignore negative constants, as the code below doesn't handle them
+ // correctly. TODO: Remove this restriction.
+ if (!C->getValue().isStrictlyPositive()) continue;
+
/* Add new PHINode. */
PHINode *NewPH = PHINode::Create(DestTy, "IV.S.", PH);
OpenPOWER on IntegriCloud