[llvm-commits] [llvm] r73787 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Dan Gohman gohman at apple.com
Fri Jun 19 16:03:47 PDT 2009


Author: djg
Date: Fri Jun 19 18:03:46 2009
New Revision: 73787

URL: http://llvm.org/viewvc/llvm-project?rev=73787&view=rev
Log:
Fix LSR's OptimizeSMax to ignore max operators with more than 2 operands,
which it isn't prepared to handle.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=73787&r1=73786&r2=73787&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Fri Jun 19 18:03:46 2009
@@ -2116,6 +2116,11 @@
   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;





More information about the llvm-commits mailing list