summaryrefslogtreecommitdiff
path: root/lib/Support/ConstantRange.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-07-13 04:50:21 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-07-13 04:50:21 +0000
commit780905e9f9f29419de56b47253f6db84bc659f42 (patch)
tree3eb9d1299fa478b4599b91f6a16bf3b9420521fd /lib/Support/ConstantRange.cpp
parentff84de767a9baded740abd1e846938477a4b285a (diff)
downloadllvm-780905e9f9f29419de56b47253f6db84bc659f42.tar.gz
llvm-780905e9f9f29419de56b47253f6db84bc659f42.tar.bz2
llvm-780905e9f9f29419de56b47253f6db84bc659f42.tar.xz
Fix an error in ConstantRange::getSignedMax on wrapped ranges. Thanks once
again to Daniel Dunbar and KLEE! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75449 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/ConstantRange.cpp')
-rw-r--r--lib/Support/ConstantRange.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp
index ca25491f62..4cb54bde1b 100644
--- a/lib/Support/ConstantRange.cpp
+++ b/lib/Support/ConstantRange.cpp
@@ -159,14 +159,10 @@ APInt ConstantRange::getSignedMax() const {
else
return SignedMax;
} else {
- if ((getUpper() - 1).slt(getLower())) {
- if (getLower() != SignedMax)
- return SignedMax;
- else
- return getUpper() - 1;
- } else {
+ if (getLower().isNegative() == getUpper().isNegative())
+ return SignedMax;
+ else
return getUpper() - 1;
- }
}
}