From: Craig Topper Date: Sun, 22 Jul 2018 05:16:50 +0000 (+0000) Subject: [SelectionDAGBuilder] Use APInt::isZero instead of comparing APInt::getZExtValue... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7a0e9e5b05438f5b4a88987a6ef303a6aa1802d6;p=llvm [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337652 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 59b0e625baf..f91cf709df5 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -2757,7 +2757,7 @@ static bool isVectorReductionOp(const User *I) { return false; const ConstantInt *Val = dyn_cast(U->getOperand(1)); - if (!Val || Val->getZExtValue() != 0) + if (!Val || !Val->isZero()) return false; ReduxExtracted = true;