From 5fa65037ac7d65d439fc9c2c0434942273803ae0 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 5 Dec 2024 14:48:34 +0100 Subject: [PATCH] [InstCombine] Remove nusw handling in ptrtoint of gep fold Now that #111144 infers gep nuw, we no longer have to repeat the inference in this fold. --- llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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; } }