diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index f997d60a85ee..c7ab9df57224 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -9877,12 +9877,15 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { const IntegerType *IT = cast(II->getOperand(1)->getType()); uint32_t BitWidth = IT->getBitWidth(); APInt Mask = APInt::getSignBit(BitWidth); - APInt LHSKnownZero, LHSKnownOne, RHSKnownZero, RHSKnownOne; + APInt LHSKnownZero(BitWidth, 0); + APInt LHSKnownOne(BitWidth, 0); ComputeMaskedBits(LHS, Mask, LHSKnownZero, LHSKnownOne); bool LHSKnownNegative = LHSKnownOne[BitWidth - 1]; bool LHSKnownPositive = LHSKnownZero[BitWidth - 1]; if (LHSKnownNegative || LHSKnownPositive) { + APInt RHSKnownZero(BitWidth, 0); + APInt RHSKnownOne(BitWidth, 0); ComputeMaskedBits(RHS, Mask, RHSKnownZero, RHSKnownOne); bool RHSKnownNegative = RHSKnownOne[BitWidth - 1]; bool RHSKnownPositive = RHSKnownZero[BitWidth - 1];