diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2013-10-30 15:36:50 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2013-10-30 15:36:50 +0000 |
commit | d3b64efcb33415e980035371b3e8de1e501a6f12 (patch) | |
tree | d4fecab21ac4aef567387698868d03605b51f601 /lib/Support/ConstantRange.cpp | |
parent | c385709d8397ca1535481c04564b67d07c66c619 (diff) | |
download | llvm-d3b64efcb33415e980035371b3e8de1e501a6f12.tar.gz llvm-d3b64efcb33415e980035371b3e8de1e501a6f12.tar.bz2 llvm-d3b64efcb33415e980035371b3e8de1e501a6f12.tar.xz |
make ConstantRange::signExtend() optimal
the case [x, INT_MIN) was not handled optimally
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193694 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/ConstantRange.cpp')
-rw-r--r-- | lib/Support/ConstantRange.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp index 1085a45d0a..e3b43ed6df 100644 --- a/lib/Support/ConstantRange.cpp +++ b/lib/Support/ConstantRange.cpp @@ -445,6 +445,11 @@ ConstantRange ConstantRange::signExtend(uint32_t DstTySize) const { unsigned SrcTySize = getBitWidth(); assert(SrcTySize < DstTySize && "Not a value extension"); + + // special case: [X, INT_MIN) -- not really wrapping around + if (Upper == APInt::getHighBitsSet(SrcTySize, 1)) + return ConstantRange(Lower.sext(DstTySize), Upper.zext(DstTySize)); + if (isFullSet() || isSignWrappedSet()) { return ConstantRange(APInt::getHighBitsSet(DstTySize,DstTySize-SrcTySize+1), APInt::getLowBitsSet(DstTySize, SrcTySize-1) + 1); |