]> granicus.if.org Git - llvm/commitdiff
[SelectionDAGBuilder] Use APInt::isZero instead of comparing APInt::getZExtValue...
authorCraig Topper <craig.topper@intel.com>
Sun, 22 Jul 2018 05:16:50 +0000 (05:16 +0000)
committerCraig Topper <craig.topper@intel.com>
Sun, 22 Jul 2018 05:16:50 +0000 (05:16 +0000)
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

lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

index 59b0e625baf1dc0aa7192e94c729333c7df91ab3..f91cf709df5dbd5518e0964fb2a68b006dcd1903 100644 (file)
@@ -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;