[llvm-commits] [llvm] r71173 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Dan Gohman gohman at apple.com
Thu May 7 12:23:22 PDT 2009


Author: djg
Date: Thu May  7 14:23:21 2009
New Revision: 71173

URL: http://llvm.org/viewvc/llvm-project?rev=71173&view=rev
Log:
SCEVComplexityCompare's new code was missing SCEVUDivExpr. Implement
the SCEVUDivExpr case.

Modified:
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=71173&r1=71172&r2=71173&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Thu May  7 14:23:21 2009
@@ -502,6 +502,20 @@
         return LC->getNumOperands() < RC->getNumOperands();
       }
 
+      // Lexicographically compare udiv expressions.
+      if (const SCEVUDivExpr *LC = dyn_cast<SCEVUDivExpr>(LHS)) {
+        const SCEVUDivExpr *RC = cast<SCEVUDivExpr>(RHS);
+        if (operator()(LC->getLHS(), RC->getLHS()))
+          return true;
+        if (operator()(RC->getLHS(), LC->getLHS()))
+          return false;
+        if (operator()(LC->getRHS(), RC->getRHS()))
+          return true;
+        if (operator()(RC->getRHS(), LC->getRHS()))
+          return false;
+        return false;
+      }
+
       // Compare cast expressions by operand.
       if (const SCEVCastExpr *LC = dyn_cast<SCEVCastExpr>(LHS)) {
         const SCEVCastExpr *RC = cast<SCEVCastExpr>(RHS);





More information about the llvm-commits mailing list