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

Dan Gohman gohman at apple.com
Mon Apr 14 11:24:08 PDT 2008


Author: djg
Date: Mon Apr 14 13:23:56 2008
New Revision: 49670

URL: http://llvm.org/viewvc/llvm-project?rev=49670&view=rev
Log:
In the special case, call the comparison function instead of
manually performing the comparison. This allows the special
case to work correctly even in the case where someone is
experimenting with a different comparison function :-).

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=49670&r1=49669&r2=49670&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Apr 14 13:23:56 2008
@@ -431,7 +431,7 @@
   /// than the complexity of the RHS.  This comparator is used to canonicalize
   /// expressions.
   struct VISIBILITY_HIDDEN SCEVComplexityCompare {
-    bool operator()(SCEV *LHS, SCEV *RHS) {
+    bool operator()(const SCEV *LHS, const SCEV *RHS) const {
       return LHS->getSCEVType() < RHS->getSCEVType();
     }
   };
@@ -452,7 +452,7 @@
   if (Ops.size() == 2) {
     // This is the common case, which also happens to be trivially simple.
     // Special case it.
-    if (Ops[0]->getSCEVType() > Ops[1]->getSCEVType())
+    if (SCEVComplexityCompare()(Ops[1], Ops[0]))
       std::swap(Ops[0], Ops[1]);
     return;
   }





More information about the llvm-commits mailing list