summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-04-30 00:44:05 +0000
committerCraig Topper <craig.topper@gmail.com>2017-04-30 00:44:05 +0000
commit866165309f3d776ad795bb545383028be3eefa21 (patch)
tree126b5f45a948f8ffc3b9274afb480b51be99ccf4 /llvm/lib
parentc12f10fe191759436526b118b85980ce1c41499f (diff)
downloadbcm5719-llvm-866165309f3d776ad795bb545383028be3eefa21.tar.gz
bcm5719-llvm-866165309f3d776ad795bb545383028be3eefa21.zip
[ConstantRange] Fix a couple cases where we were possibly throwing away an APInt allocation we could reuse. NFC
This uses setAllBits to replace getMaxValue and operator=(uint64_t) instead of constructing an APInt from uint64_t. llvm-svn: 301761
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/ConstantRange.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/ConstantRange.cpp b/llvm/lib/IR/ConstantRange.cpp
index 4d7e73eb07f..5425676e4ed 100644
--- a/llvm/lib/IR/ConstantRange.cpp
+++ b/llvm/lib/IR/ConstantRange.cpp
@@ -581,7 +581,7 @@ ConstantRange ConstantRange::truncate(uint32_t DstTySize) const {
return ConstantRange(DstTySize, /*isFullSet=*/true);
Union = ConstantRange(APInt::getMaxValue(DstTySize),Upper.trunc(DstTySize));
- UpperDiv = APInt::getMaxValue(getBitWidth());
+ UpperDiv.setAllBits();
// Union covers the MaxValue case, so return if the remaining range is just
// MaxValue.
@@ -837,7 +837,7 @@ ConstantRange::udiv(const ConstantRange &RHS) const {
if (RHS.getUpper() == 1)
RHS_umin = RHS.getLower();
else
- RHS_umin = APInt(getBitWidth(), 1);
+ RHS_umin = 1;
}
APInt Upper = getUnsignedMax().udiv(RHS_umin) + 1;
OpenPOWER on IntegriCloud