summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commit55e3dd9174c969f1538d0992fd2050f7625dee5c (patch)
tree1d5203cf1c17dc9ff206cea2100be9fc8db3a578 /llvm/lib
parentda10358c84e60e5f746007bb81331ba4e0a1ff51 (diff)
downloadbcm5719-llvm-55e3dd9174c969f1538d0992fd2050f7625dee5c.tar.gz
bcm5719-llvm-55e3dd9174c969f1538d0992fd2050f7625dee5c.zip
Fix LSR's OptimizeSMax to ignore max operators with more than 2 operands,
which it isn't prepared to handle. llvm-svn: 73787
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 03966672d62..dac734029b4 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud