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

Dan Gohman gohman at apple.com
Mon Aug 16 09:25:36 PDT 2010


Author: djg
Date: Mon Aug 16 11:25:35 2010
New Revision: 111142

URL: http://llvm.org/viewvc/llvm-project?rev=111142&view=rev
Log:
Micro-optimize SCEVConstant comparison.

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=111142&r1=111141&r2=111142&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Aug 16 11:25:35 2010
@@ -590,12 +590,12 @@
       // Compare constant values.
       if (const SCEVConstant *LC = dyn_cast<SCEVConstant>(LHS)) {
         const SCEVConstant *RC = cast<SCEVConstant>(RHS);
-        const ConstantInt *LCC = LC->getValue();
-        const ConstantInt *RCC = RC->getValue();
-        unsigned LBitWidth = LCC->getBitWidth(), RBitWidth = RCC->getBitWidth();
+        const APInt &LA = LC->getValue()->getValue();
+        const APInt &RA = RC->getValue()->getValue();
+        unsigned LBitWidth = LA.getBitWidth(), RBitWidth = RA.getBitWidth();
         if (LBitWidth != RBitWidth)
           return LBitWidth < RBitWidth;
-        return LCC->getValue().ult(RCC->getValue());
+        return LA.ult(RA);
       }
 
       // Compare addrec loop depths.





More information about the llvm-commits mailing list