Micro-optimize SCEVConstant comparison.
authorDan Gohman <gohman@apple.com>
Mon, 16 Aug 2010 16:25:35 +0000 (16:25 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 16 Aug 2010 16:25:35 +0000 (16:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111142 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index 73bc8b1727669f55a7a54ac6019a17aa74b660ab..56777c3adb238f92e819d13e7e49515c518c404e 100644 (file)
@@ -590,12 +590,12 @@ namespace {
       // 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.