[llvm] [InstCombine] Fold chained GEP with constant base into single GEP (PR #170439)
Jianjian Guan via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 3 22:48:41 PST 2025
jacquesguan wrote:
> The fold makes sense to me. Please see https://llvm.org/docs/InstCombineContributorGuide.html. Please add an alive2 proof to the PR description.
>
> * As far as I can tell, you seem to assume without verifying that both GEPs have the same source element type? You should probably just limit the transform to canonical i8 GEPs and use m_PtrAdd matchers.
> * Please add multi-use tests. In particular, we should not perform the transform for a multi-use select, right?
> * You are using getMergedGEPNoWrapFlags, but there does not seem to be any test coverage for the nowrap flag preservation behavior. You need to test different combinations of flags on both GEPs.
Thanks for comment, multi-use select and nowrap flags cases were added.
https://github.com/llvm/llvm-project/pull/170439
More information about the llvm-commits
mailing list