[PATCH] D125845: [InstCombine] Canonicalize GEP of GEP and merging GEP with constant indices

William Junda Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 18:53:18 PDT 2022


huangjd created this revision.
huangjd added reviewers: davidxl, Carrot, nikic, spatel, reames.
Herald added a subscriber: hiraditya.
Herald added a project: All.
huangjd requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Canonicalize GEP of GEP by swapping GEP with some suffix constant indices to the back (and GEP with all constant indices to the back of that), this allows more constant index GEP merging to happen. Exceptions are: If swapping violates use-def relations, or anti-optimizes LICM

For constant indexed GEP of GEP, if they cannot be merged directly, they will be casted to i8* and merged.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125845

Files:
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/test/Transforms/InstCombine/gep-canonicalize-constant-indices.ll
  llvm/test/Transforms/InstCombine/gep-merge-constant-indices.ll
  llvm/test/Transforms/InstCombine/opaque-ptr.ll
  llvm/test/Transforms/InstCombine/shift.ll
  llvm/test/Transforms/LoopVectorize/AArch64/vector-reverse-mask4.ll
  llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125845.430218.patch
Type: text/x-patch
Size: 22426 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220518/881f4d49/attachment.bin>


More information about the llvm-commits mailing list