diff options
author | Florian Hahn <flo@fhahn.com> | 2019-12-27 17:38:18 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2019-12-27 17:38:34 +0000 |
commit | b35c585a9a8185ca7de378a0d45ebb68e385e7a0 (patch) | |
tree | 5ca3f0545a4af182a9c86514babc7836a59663c4 /llvm/lib/IR/ConstantRange.cpp | |
parent | 752220ea2664c814eb1eb046d755fe63ade9c32e (diff) | |
download | bcm5719-llvm-b35c585a9a8185ca7de378a0d45ebb68e385e7a0.tar.gz bcm5719-llvm-b35c585a9a8185ca7de378a0d45ebb68e385e7a0.zip |
[ConstantRange] Respect destination bitwidth for cast results.
We returning a full set, we should use ResultBitWidth. Otherwise we might
it assertions when the resulting constant ranges are used later on.
Reviewers: nikic, spatel, reames
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D71937
Diffstat (limited to 'llvm/lib/IR/ConstantRange.cpp')
-rw-r--r-- | llvm/lib/IR/ConstantRange.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/ConstantRange.cpp b/llvm/lib/IR/ConstantRange.cpp index 2a8ea0657db..3d25cb5bfbd 100644 --- a/llvm/lib/IR/ConstantRange.cpp +++ b/llvm/lib/IR/ConstantRange.cpp @@ -641,7 +641,7 @@ ConstantRange ConstantRange::castOp(Instruction::CastOps CastOp, if (getBitWidth() == ResultBitWidth) return *this; else - return getFull(); + return getFull(ResultBitWidth); case Instruction::UIToFP: { // TODO: use input range if available auto BW = getBitWidth(); @@ -662,7 +662,7 @@ ConstantRange ConstantRange::castOp(Instruction::CastOps CastOp, case Instruction::PtrToInt: case Instruction::AddrSpaceCast: // Conservatively return getFull set. - return getFull(); + return getFull(ResultBitWidth); }; } |