[llvm] [InstComb] Fold inttoptr (add (ptrtoint %B), %O) -> GEP for ICMP users. (PR #153421)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 21 07:45:10 PDT 2025
================
@@ -2073,6 +2073,18 @@ Instruction *InstCombinerImpl::visitIntToPtr(IntToPtrInst &CI) {
return new IntToPtrInst(P, CI.getType());
}
+ // Replace (inttoptr (add (ptrtoint %Base), %Offset)) with
+ // (getelementptr i8, %Base, %Offset) if all users are ICmps.
+ Value *Base;
+ Value *Offset;
+ if (match(CI.getOperand(0),
+ m_Add(m_PtrToIntSameSize(DL, m_Value(Base)), m_Value(Offset))) &&
----------------
fhahn wrote:
Done thanks
https://github.com/llvm/llvm-project/pull/153421
More information about the llvm-commits
mailing list