[PATCH] D33815: [ConstantRange] Implement getSignedMin/Max in a less complicated and faster way
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 16 16:27:07 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL305607: [ConstantRange] Implement getSignedMin/Max in a less complicated and faster way (authored by ctopper).
Changed prior to commit:
https://reviews.llvm.org/D33815?vs=101145&id=102899#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33815
Files:
llvm/trunk/lib/IR/ConstantRange.cpp
Index: llvm/trunk/lib/IR/ConstantRange.cpp
===================================================================
--- llvm/trunk/lib/IR/ConstantRange.cpp
+++ llvm/trunk/lib/IR/ConstantRange.cpp
@@ -284,27 +284,14 @@
}
APInt ConstantRange::getSignedMax() const {
- if (!isWrappedSet()) {
- APInt UpperMinusOne = getUpper() - 1;
- if (getLower().sle(UpperMinusOne))
- return UpperMinusOne;
- return APInt::getSignedMaxValue(getBitWidth());
- }
- if (getLower().isNegative() == getUpper().isNegative())
+ if (isFullSet() || Lower.sgt(Upper))
return APInt::getSignedMaxValue(getBitWidth());
return getUpper() - 1;
}
APInt ConstantRange::getSignedMin() const {
- if (!isWrappedSet()) {
- if (getLower().sle(getUpper() - 1))
- return getLower();
+ if (isFullSet() || (Lower.sgt(Upper) && !getUpper().isMinSignedValue()))
return APInt::getSignedMinValue(getBitWidth());
- }
- if ((getUpper() - 1).slt(getLower())) {
- if (!getUpper().isMinSignedValue())
- return APInt::getSignedMinValue(getBitWidth());
- }
return getLower();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33815.102899.patch
Type: text/x-patch
Size: 1085 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170616/6af89533/attachment.bin>
More information about the llvm-commits
mailing list