[llvm] r301761 - [ConstantRange] Fix a couple cases where we were possibly throwing away an APInt allocation we could reuse. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 29 17:44:05 PDT 2017
Author: ctopper
Date: Sat Apr 29 19:44:05 2017
New Revision: 301761
URL: http://llvm.org/viewvc/llvm-project?rev=301761&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/IR/ConstantRange.cpp
Modified: llvm/trunk/lib/IR/ConstantRange.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/ConstantRange.cpp?rev=301761&r1=301760&r2=301761&view=diff
==============================================================================
--- llvm/trunk/lib/IR/ConstantRange.cpp (original)
+++ llvm/trunk/lib/IR/ConstantRange.cpp Sat Apr 29 19:44:05 2017
@@ -581,7 +581,7 @@ ConstantRange ConstantRange::truncate(ui
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
if (RHS.getUpper() == 1)
RHS_umin = RHS.getLower();
else
- RHS_umin = APInt(getBitWidth(), 1);
+ RHS_umin = 1;
}
APInt Upper = getUnsignedMax().udiv(RHS_umin) + 1;
More information about the llvm-commits
mailing list