summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorScott Linder <scott@scottlinder.com>2018-10-31 19:57:36 +0000
committerScott Linder <scott@scottlinder.com>2018-10-31 19:57:36 +0000
commit92bb783cfe11785ef5d4de5d7fc261387feb327d (patch)
treee0a29c8d8ef73501c22a7234092da6ab0a029f22 /llvm/lib/CodeGen
parent03d603be9d1b4e4ca536dc7beb318f3f515847ad (diff)
downloadbcm5719-llvm-92bb783cfe11785ef5d4de5d7fc261387feb327d.tar.gz
bcm5719-llvm-92bb783cfe11785ef5d4de5d7fc261387feb327d.zip
[SelectionDAG] Handle constant range [0,1) in lowerRangeToAssertZExt
lowerRangeToAssertZExt currently relies on something like EarlyCSE having eliminated the constant range [0,1). At -O0 this leads to an assert. Differential Revision: https://reviews.llvm.org/D53888 llvm-svn: 345770
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 5ecb2abbcbf..dac99eddec3 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -7993,7 +7993,8 @@ SDValue SelectionDAGBuilder::lowerRangeToAssertZExt(SelectionDAG &DAG,
return Op;
APInt Hi = CR.getUnsignedMax();
- unsigned Bits = Hi.getActiveBits();
+ unsigned Bits = std::max(Hi.getActiveBits(),
+ static_cast<unsigned>(IntegerType::MIN_INT_BITS));
EVT SmallVT = EVT::getIntegerVT(*DAG.getContext(), Bits);
OpenPOWER on IntegriCloud