[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp

Reid Spencer reid at x10sys.com
Sun Dec 3 18:46:59 PST 2006



Changes in directory llvm/lib/Analysis:

ConstantRange.cpp updated: 1.18 -> 1.19
---
Log message:

Change inferred casts to explicit casts.


---
Diffs of the changes:  (+5 -9)

 ConstantRange.cpp |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)


Index: llvm/lib/Analysis/ConstantRange.cpp
diff -u llvm/lib/Analysis/ConstantRange.cpp:1.18 llvm/lib/Analysis/ConstantRange.cpp:1.19
--- llvm/lib/Analysis/ConstantRange.cpp:1.18	Tue Nov 28 19:14:00 2006
+++ llvm/lib/Analysis/ConstantRange.cpp	Sun Dec  3 20:46:44 2006
@@ -293,14 +293,9 @@
 
   Constant *Lower = getLower();
   Constant *Upper = getUpper();
-  if (Lower->getType()->isInteger() && !Lower->getType()->isUnsigned()) {
-    // Ensure we are doing a ZERO extension even if the input range is signed.
-    Lower = ConstantExpr::getCast(Lower, Ty->getUnsignedVersion());
-    Upper = ConstantExpr::getCast(Upper, Ty->getUnsignedVersion());
-  }
 
-  return ConstantRange(ConstantExpr::getCast(Lower, Ty),
-                       ConstantExpr::getCast(Upper, Ty));
+  return ConstantRange(ConstantExpr::getCast(Instruction::ZExt, Lower, Ty),
+                       ConstantExpr::getCast(Instruction::ZExt, Upper, Ty));
 }
 
 /// truncate - Return a new range in the specified integer type, which must be
@@ -314,8 +309,9 @@
   if (isFullSet() || getSetSize() >= Size)
     return ConstantRange(getType());
 
-  return ConstantRange(ConstantExpr::getCast(getLower(), Ty),
-                       ConstantExpr::getCast(getUpper(), Ty));
+  return ConstantRange(
+      ConstantExpr::getCast(Instruction::Trunc, getLower(), Ty),
+      ConstantExpr::getCast(Instruction::Trunc, getUpper(), Ty));
 }
 
 






More information about the llvm-commits mailing list