[llvm] [SCEVExpander] Clear flags when reusing GEP (PR #109293)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 19 07:56:34 PDT 2024
================
@@ -370,11 +375,15 @@ Value *SCEVExpander::expandAddToGEP(const SCEV *Offset, Value *V) {
// generated code.
if (isa<DbgInfoIntrinsic>(IP))
ScanLimit++;
- if (IP->getOpcode() == Instruction::GetElementPtr &&
- IP->getOperand(0) == V && IP->getOperand(1) == Idx &&
- cast<GEPOperator>(&*IP)->getSourceElementType() ==
- Builder.getInt8Ty())
- return &*IP;
+ if (auto *GEP = dyn_cast<GetElementPtrInst>(IP)) {
+ if (GEP->getPointerOperand() == V &&
+ GEP->getSourceElementType() == Builder.getInt8Ty() &&
+ GEP->getOperand(1) == Idx) {
+ rememberFlags(GEP);
+ GEP->setNoWrapFlags(GEPNoWrapFlags::none());
----------------
nikic wrote:
In https://github.com/llvm/llvm-project/pull/102133 this will become an intersect with SCEV nuw flag instead.
https://github.com/llvm/llvm-project/pull/109293
More information about the llvm-commits
mailing list