diff --git a/lib/Transforms/InstCombine/InstCombineCasts.cpp b/lib/Transforms/InstCombine/InstCombineCasts.cpp index d2ab61845f2..77ad8289585 100644 --- a/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -912,7 +912,8 @@ Instruction *InstCombiner::transformSExtICmp(ICmpInst *ICI, Instruction &CI) { APInt TypeMask(APInt::getAllOnesValue(BitWidth)); ComputeMaskedBits(Op0, TypeMask, KnownZero, KnownOne); - if ((~KnownZero).isPowerOf2()) { + APInt KnownZeroMask(~KnownZero); + if (KnownZeroMask.isPowerOf2()) { Value *In = ICI->getOperand(0); if (!Op1C->isZero() == (Pred == ICmpInst::ICMP_NE)) {