diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index 7221c987b9821..d21714b10155d 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -2106,10 +2106,7 @@ Instruction *InstCombinerImpl::visitPtrToInt(PtrToIntInst &CI) { Base->getType() == Ty) { Value *Offset = EmitGEPOffset(GEP); auto *NewOp = BinaryOperator::CreateAdd(Base, Offset); - if (GEP->hasNoUnsignedWrap() || - (GEP->hasNoUnsignedSignedWrap() && - isKnownNonNegative(Offset, SQ.getWithInstruction(&CI)))) - NewOp->setHasNoUnsignedWrap(true); + NewOp->setHasNoUnsignedWrap(GEP->hasNoUnsignedWrap()); return NewOp; } }