[PATCH] D155218: [InstCombine] Optimize addition/subtraction operations of splats of vscale multiplied by a constant

Igor Kirillov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 09:43:18 PDT 2023


igor.kirillov created this revision.
Herald added subscribers: mgabka, hiraditya.
Herald added a project: All.
igor.kirillov requested review of this revision.
Herald added subscribers: llvm-commits, wangpc.
Herald added a project: LLVM.

This patch enhances the InstCombine pass to optimize addition and
subtraction operations involving splat values optionally multiplied
by a constant or shifted by a constant. The transformation combines
the operations as follows:

  (A +/- splat(B)) +/- splat(C) -> A +/- splat(B +/- C)

This optimization improves the performance of vectorized code with
interleave factor > 1, where indices are part of an expression.
For example, in cases such as the following loop:

  for (int i = A; i < B; ++i)
    out[i + offset] = (i + X) * Y;


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155218

Files:
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/test/Transforms/InstCombine/vscale.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-gather-scatter.ll
  llvm/test/Transforms/LoopVectorize/scalable-inductions.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155218.540084.patch
Type: text/x-patch
Size: 15144 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230713/57adea01/attachment.bin>


More information about the llvm-commits mailing list