[llvm] [InstCombine] Move nonnull assumptions to the base of a gep (PR #195650)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon May 4 06:36:40 PDT 2026
================
@@ -3716,6 +3716,24 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
return CallBase::removeOperandBundle(II, OBU.getTagID());
}
+ // Move assume to the base pointer of a gep if it's inbounds
+ if (auto *GEP = dyn_cast<GEPOperator>(RK.WasOn); GEP && GEP->isInBounds()) {
+ while (true) {
+ auto *NextGEP = dyn_cast<GEPOperator>(GEP->getPointerOperand());
+ if (!NextGEP || !NextGEP->isInBounds())
+ break;
+ GEP = NextGEP;
+ }
----------------
nikic wrote:
You can use stripInBoundsOffsets() here.
https://github.com/llvm/llvm-project/pull/195650
More information about the llvm-commits
mailing list