[PATCH] D106450: [InstCombine] Fold (gep (oneuse(gep Ptr, Idx0)), Idx1) -> (gep Ptr, (add Idx0, Idx1)) (PR51069)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 22 07:21:24 PDT 2021


lebedev.ri added a comment.

FWIW i think the obvious generalization here is that only the outer GEP needs to have two operands,
we just need to fold it's index operand into the last operand of inner one-use GEP:
https://alive2.llvm.org/ce/z/UTBPnG

Or the other way around: the previous GEP could have only two operands,
and then we just need to fold it into the first index:
https://alive2.llvm.org/ce/z/xWVW8J

But i guess these aren't really interesting for the select-of-gep's, outside of the bigger pattern at least.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106450/new/

https://reviews.llvm.org/D106450



More information about the llvm-commits mailing list