diff options
| author | Jay Foad <jay.foad@gmail.com> | 2010-12-07 08:25:19 +0000 | 
|---|---|---|
| committer | Jay Foad <jay.foad@gmail.com> | 2010-12-07 08:25:19 +0000 | 
| commit | 583abbc4df3d9b9e5a86a56ae581970b98dc5249 (patch) | |
| tree | 62e559937dd04e2a764f7423e50f94a5641022f9 /llvm/lib/Support/ConstantRange.cpp | |
| parent | 10e1b56e2c9b920d5f3509abb8a6df3815200839 (diff) | |
| download | llvm-583abbc4df3d9b9e5a86a56ae581970b98dc5249.zip llvm-583abbc4df3d9b9e5a86a56ae581970b98dc5249.tar.gz llvm-583abbc4df3d9b9e5a86a56ae581970b98dc5249.tar.bz2  | |
PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.
llvm-svn: 121120
Diffstat (limited to 'llvm/lib/Support/ConstantRange.cpp')
| -rw-r--r-- | llvm/lib/Support/ConstantRange.cpp | 12 | 
1 files changed, 3 insertions, 9 deletions
diff --git a/llvm/lib/Support/ConstantRange.cpp b/llvm/lib/Support/ConstantRange.cpp index 7f68fd3..493f708 100644 --- a/llvm/lib/Support/ConstantRange.cpp +++ b/llvm/lib/Support/ConstantRange.cpp @@ -442,9 +442,7 @@ ConstantRange ConstantRange::zeroExtend(uint32_t DstTySize) const {      // Change into [0, 1 << src bit width)      return ConstantRange(APInt(DstTySize,0), APInt(DstTySize,1).shl(SrcTySize)); -  APInt L = Lower; L.zext(DstTySize); -  APInt U = Upper; U.zext(DstTySize); -  return ConstantRange(L, U); +  return ConstantRange(Lower.zext(DstTySize), Upper.zext(DstTySize));  }  /// signExtend - Return a new range in the specified integer type, which must @@ -461,9 +459,7 @@ ConstantRange ConstantRange::signExtend(uint32_t DstTySize) const {                           APInt::getLowBitsSet(DstTySize, SrcTySize-1) + 1);    } -  APInt L = Lower; L.sext(DstTySize); -  APInt U = Upper; U.sext(DstTySize); -  return ConstantRange(L, U); +  return ConstantRange(Lower.sext(DstTySize), Upper.sext(DstTySize));  }  /// truncate - Return a new range in the specified integer type, which must be @@ -477,9 +473,7 @@ ConstantRange ConstantRange::truncate(uint32_t DstTySize) const {    if (isFullSet() || getSetSize().ugt(Size))      return ConstantRange(DstTySize, /*isFullSet=*/true); -  APInt L = Lower; L.trunc(DstTySize); -  APInt U = Upper; U.trunc(DstTySize); -  return ConstantRange(L, U); +  return ConstantRange(Lower.trunc(DstTySize), Upper.trunc(DstTySize));  }  /// zextOrTrunc - make this range have the bit width given by \p DstTySize. The  | 
