summaryrefslogtreecommitdiff
path: root/lib/Support
diff options
context:
space:
mode:
authorZhou Sheng <zhousheng00@gmail.com>2007-04-13 05:57:32 +0000
committerZhou Sheng <zhousheng00@gmail.com>2007-04-13 05:57:32 +0000
commitdaacf22537e0d140c379a39a11a83d3321395d4d (patch)
treed8802dfad40064b54cbc9e3e9dd916c22f37f1f3 /lib/Support
parent7fec90ebf4ebe7aa73a6dd7d275c255587c041ad (diff)
downloadllvm-daacf22537e0d140c379a39a11a83d3321395d4d.tar.gz
llvm-daacf22537e0d140c379a39a11a83d3321395d4d.tar.bz2
llvm-daacf22537e0d140c379a39a11a83d3321395d4d.tar.xz
Make the apint construction more effective.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35960 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/ConstantRange.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp
index 79a85b80d7..7179649330 100644
--- a/lib/Support/ConstantRange.cpp
+++ b/lib/Support/ConstantRange.cpp
@@ -108,7 +108,7 @@ APInt ConstantRange::getUnsignedMin() const {
/// 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 @@ APInt ConstantRange::getSignedMax() const {
/// 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::signExtend(uint32_t DstTySize) const {
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);