forked from OSchip/llvm-project
Fix LSR's OptimizeSMax to ignore max operators with more than 2 operands,
which it isn't prepared to handle. llvm-svn: 73787
This commit is contained in:
parent
da10358c84
commit
55e3dd9174
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue