aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-19 23:03:46 +0000
committerDan Gohman <gohman@apple.com>2009-06-19 23:03:46 +0000
commit4d1c1efd800727165c12c2d186a5cb0b4f5834ab (patch)
tree4bc7892c5356a072e7f976c5f5c14ed99e6f654d /lib/Transforms/Scalar/LoopStrengthReduce.cpp
parent1e86a66b00b94adc4ad6977ef6b47c516ac62cec (diff)
downloadexternal_llvm-4d1c1efd800727165c12c2d186a5cb0b4f5834ab.zip
external_llvm-4d1c1efd800727165c12c2d186a5cb0b4f5834ab.tar.gz
external_llvm-4d1c1efd800727165c12c2d186a5cb0b4f5834ab.tar.bz2
Fix LSR's OptimizeSMax to ignore max operators with more than 2 operands,
which it isn't prepared to handle. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73787 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 0396667..dac7340 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -2116,6 +2116,11 @@ ICmpInst *LoopStrengthReduce::OptimizeSMax(Loop *L, ICmpInst *Cond,
const SCEVSMaxExpr *SMax = dyn_cast<SCEVSMaxExpr>(IterationCount);
if (!SMax || SMax != SE->getSCEV(Sel)) return Cond;
+ // Two handle a max with more than two operands, this optimization would
+ // require additional checking and setup.
+ if (SMax->getNumOperands() != 2)
+ return Cond;
+
SCEVHandle SMaxLHS = SMax->getOperand(0);
SCEVHandle SMaxRHS = SMax->getOperand(1);
if (!SMaxLHS || SMaxLHS != One) return Cond;