diff options
| author | Dan Gohman <gohman@apple.com> | 2010-06-22 23:07:13 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2010-06-22 23:07:13 +0000 |
| commit | abfcefc69bc060459374ba97f67a4f5ba545ff70 (patch) | |
| tree | de84a2c2f3627c0fc221b534de15f4ef97abd29c /lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
| parent | 6b17c2b4a60ce8ed88f1d9d6d551449803f25620 (diff) | |
| download | external_llvm-abfcefc69bc060459374ba97f67a4f5ba545ff70.zip external_llvm-abfcefc69bc060459374ba97f67a4f5ba545ff70.tar.gz external_llvm-abfcefc69bc060459374ba97f67a4f5ba545ff70.tar.bz2 | |
Fix OptimizeMax to handle an odd case where one of the max operands
is another max which folds. This fixes PR7454.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106594 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
| -rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index d14d7d9..e8da89a 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -1643,8 +1643,11 @@ ICmpInst *LSRInstance::OptimizeMax(ICmpInst *Cond, IVStrideUse* &CondUse) { NewRHS = Sel->getOperand(1); else if (SE.getSCEV(Sel->getOperand(2)) == MaxRHS) NewRHS = Sel->getOperand(2); + else if (const SCEVUnknown *SU = dyn_cast<SCEVUnknown>(MaxRHS)) + NewRHS = SU->getValue(); else - llvm_unreachable("Max doesn't match expected pattern!"); + // Max doesn't match expected pattern. + return Cond; // Determine the new comparison opcode. It may be signed or unsigned, // and the original comparison may be either equality or inequality. |
