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

Zhou Sheng zhousheng00 at gmail.com
Thu Apr 12 22:57:50 PDT 2007



Changes in directory llvm/lib/Support:

ConstantRange.cpp updated: 1.43 -> 1.44
---
Log message:

Make the apint construction more effective.


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

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


Index: llvm/lib/Support/ConstantRange.cpp
diff -u llvm/lib/Support/ConstantRange.cpp:1.43 llvm/lib/Support/ConstantRange.cpp:1.44
--- llvm/lib/Support/ConstantRange.cpp:1.43	Sat Apr  7 10:41:33 2007
+++ llvm/lib/Support/ConstantRange.cpp	Fri Apr 13 00:57:32 2007
@@ -108,7 +108,7 @@
 /// ConstantRange.
 ///
 APInt ConstantRange::getSignedMax() const {
-  APInt SignedMax = APInt::getSignedMaxValue(getBitWidth());
+  APInt SignedMax(APInt::getSignedMaxValue(getBitWidth()));
   if (!isWrappedSet()) {
     if (getLower().slt(getUpper() - 1))
       return getUpper() - 1;
@@ -130,7 +130,7 @@
 /// ConstantRange.
 ///
 APInt ConstantRange::getSignedMin() const {
-  APInt SignedMin = APInt::getSignedMinValue(getBitWidth());
+  APInt SignedMin(APInt::getSignedMinValue(getBitWidth()));
   if (!isWrappedSet()) {
     if (getLower().slt(getUpper() - 1))
       return getLower();
@@ -370,7 +370,7 @@
 ConstantRange ConstantRange::truncate(uint32_t DstTySize) const {
   unsigned SrcTySize = getBitWidth();
   assert(SrcTySize > DstTySize && "Not a value truncation");
-  APInt Size = APInt::getMaxValue(DstTySize).zext(SrcTySize);
+  APInt Size(APInt::getLowBitsSet(SrcTySize, DstTySize));
   if (isFullSet() || getSetSize().ugt(Size))
     return ConstantRange(DstTySize);
 






More information about the llvm-commits mailing list