diff options
author | Craig Topper <craig.topper@intel.com> | 2018-07-22 05:16:50 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2018-07-22 05:16:50 +0000 |
commit | b8b21d2fcac48ef26d3af325cc4d6cf4bddb78f7 (patch) | |
tree | 1f6a38dc1f216b4c294e3c7e898a39c78d76b25d /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | |
parent | bf61113e4f57dd115e583828afb51b19ea53cf87 (diff) | |
download | bcm5719-llvm-b8b21d2fcac48ef26d3af325cc4d6cf4bddb78f7.tar.gz bcm5719-llvm-b8b21d2fcac48ef26d3af325cc4d6cf4bddb78f7.zip |
[SelectionDAGBuilder] Use APInt::isZero instead of comparing APInt::getZExtValue to 0 in a place where we can't be sure contents of the APInt fit in a uint64_t.
This is used on an extract vector element index which is most cases is going to be an i32 or i64 and the element will be a valid element number. But it is possible to construct IR with a larger type and large out of range value.
llvm-svn: 337652
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 59b0e625baf..f91cf709df5 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -2757,7 +2757,7 @@ static bool isVectorReductionOp(const User *I) { return false; const ConstantInt *Val = dyn_cast<ConstantInt>(U->getOperand(1)); - if (!Val || Val->getZExtValue() != 0) + if (!Val || !Val->isZero()) return false; ReduxExtracted = true; |