[PATCH] D129734: [InstCombine] Canonicalize GEP of GEP by swapping constant-indexed GEP to the front

William Junda Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 00:07:04 PDT 2022


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

Alternative implementation to D125845 <https://reviews.llvm.org/D125845>. This way the code is cleaner as it will not interfere with LICM, because swapping constant GEP to the front will actually allow LICM to move it out of the loop. In addition, it is possibly more beneficial to codegen since evaluation of variable indices is pushed to the back, reducing potential pipeline stall on some architectures.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129734

Files:
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/test/Transforms/InstCombine/gep-canonicalize-constant-indices.ll
  llvm/test/Transforms/InstCombine/gep-combine-loop-invariant.ll
  llvm/test/Transforms/InstCombine/gep-merge-constant-indices.ll
  llvm/test/Transforms/InstCombine/opaque-ptr.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: D129734.444534.patch
Type: text/x-patch
Size: 22841 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220714/2817d7b9/attachment.bin>


More information about the llvm-commits mailing list