Skip to content

Commit d09632b

Browse files
authored
[InstCombine] Remove nusw handling in ptrtoint of gep fold (NFCI) (#118804)
Now that #111144 infers gep nuw, we no longer have to repeat the inference in this fold.
1 parent 3bd3fa6 commit d09632b

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,10 +2106,7 @@ Instruction *InstCombinerImpl::visitPtrToInt(PtrToIntInst &CI) {
21062106
Base->getType() == Ty) {
21072107
Value *Offset = EmitGEPOffset(GEP);
21082108
auto *NewOp = BinaryOperator::CreateAdd(Base, Offset);
2109-
if (GEP->hasNoUnsignedWrap() ||
2110-
(GEP->hasNoUnsignedSignedWrap() &&
2111-
isKnownNonNegative(Offset, SQ.getWithInstruction(&CI))))
2112-
NewOp->setHasNoUnsignedWrap(true);
2109+
NewOp->setHasNoUnsignedWrap(GEP->hasNoUnsignedWrap());
21132110
return NewOp;
21142111
}
21152112
}

0 commit comments

Comments
 (0)