summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/Float2Int.cpp
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-03-24 09:34:40 +0000
committerNikita Popov <nikita.ppv@gmail.com>2019-03-24 09:34:40 +0000
commit977934f00f7cac6476650db75f6497495908b486 (patch)
tree92c865ad86f73d4314bf45c53b4ae5dcf3a2ff88 /llvm/lib/Transforms/Scalar/Float2Int.cpp
parent54ce1b18c5f77002a1f0bc1fefa076109df8b847 (diff)
downloadbcm5719-llvm-977934f00f7cac6476650db75f6497495908b486.tar.gz
bcm5719-llvm-977934f00f7cac6476650db75f6497495908b486.zip
[ConstantRange] Add getFull() + getEmpty() named constructors; NFC
This adds ConstantRange::getFull(BitWidth) and ConstantRange::getEmpty(BitWidth) named constructors as more readable alternatives to the current ConstantRange(BitWidth, /* full */ false) and similar. Additionally private getFull() and getEmpty() member functions are added which return a full/empty range with the same bit width -- these are commonly needed inside ConstantRange.cpp. The IsFullSet argument in the ConstantRange(BitWidth, IsFullSet) constructor is now mandatory for the few usages that still make use of it. Differential Revision: https://reviews.llvm.org/D59716 llvm-svn: 356852
Diffstat (limited to 'llvm/lib/Transforms/Scalar/Float2Int.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/Float2Int.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/Float2Int.cpp b/llvm/lib/Transforms/Scalar/Float2Int.cpp
index 4a1275d3661..cb0288a28f7 100644
--- a/llvm/lib/Transforms/Scalar/Float2Int.cpp
+++ b/llvm/lib/Transforms/Scalar/Float2Int.cpp
@@ -147,10 +147,10 @@ void Float2IntPass::seen(Instruction *I, ConstantRange R) {
// Helper - get a range representing a poison value.
ConstantRange Float2IntPass::badRange() {
- return ConstantRange(MaxIntegerBW + 1, true);
+ return ConstantRange::getFull(MaxIntegerBW + 1);
}
ConstantRange Float2IntPass::unknownRange() {
- return ConstantRange(MaxIntegerBW + 1, false);
+ return ConstantRange::getEmpty(MaxIntegerBW + 1);
}
ConstantRange Float2IntPass::validateRange(ConstantRange R) {
if (R.getBitWidth() > MaxIntegerBW + 1)
@@ -194,7 +194,7 @@ void Float2IntPass::walkBackwards(const SmallPtrSetImpl<Instruction*> &Roots) {
// Path terminated cleanly - use the type of the integer input to seed
// the analysis.
unsigned BW = I->getOperand(0)->getType()->getPrimitiveSizeInBits();
- auto Input = ConstantRange(BW, true);
+ auto Input = ConstantRange::getFull(BW);
auto CastOp = (Instruction::CastOps)I->getOpcode();
seen(I, validateRange(Input.castOp(CastOp, MaxIntegerBW+1)));
continue;
OpenPOWER on IntegriCloud