summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2013-10-30 15:36:50 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2013-10-30 15:36:50 +0000
commit1112eca0afb3b919b44de6b8688c37dd5111a300 (patch)
tree33a2254d31a892968c8406bfb98c01237a67abd6 /llvm/lib/Support
parentab94b537d75278f93918b202417c23ad561a101b (diff)
downloadbcm5719-llvm-1112eca0afb3b919b44de6b8688c37dd5111a300.tar.gz
bcm5719-llvm-1112eca0afb3b919b44de6b8688c37dd5111a300.zip
make ConstantRange::signExtend() optimal
the case [x, INT_MIN) was not handled optimally llvm-svn: 193694
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/ConstantRange.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Support/ConstantRange.cpp b/llvm/lib/Support/ConstantRange.cpp
index 1085a45d0a2..e3b43ed6df6 100644
--- a/llvm/lib/Support/ConstantRange.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud