[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Dec 5 10:24:09 PST 2005



Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.70 -> 1.71
---
Log message:

getRawValue zero extens for unsigned values, use getsextvalue so that we
know that small negative values fit into the immediate field of addressing
modes.


---
Diffs of the changes:  (+3 -3)

 LoopStrengthReduce.cpp |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.70 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.71
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.70	Fri Oct 21 00:45:41 2005
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp	Mon Dec  5 12:23:57 2005
@@ -560,9 +560,9 @@
   // FIXME: Look at the target to decide if &GV is a legal constant immediate.
   if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V)) {
     // PPC allows a sign-extended 16-bit immediate field.
-    if ((int64_t)SC->getValue()->getRawValue() > -(1 << 16) &&
-        (int64_t)SC->getValue()->getRawValue() < (1 << 16)-1)
-      return true;
+    int64_t V = SC->getValue()->getSExtValue();
+    if (V > -(1 << 16) && V < (1 << 16)-1)
+        return true;
     return false;
   }
 






More information about the llvm-commits mailing list