[PATCH] D153972: [AArch64] Fold tree of offset loads combine

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 06:58:34 PDT 2023


dmgreen created this revision.
dmgreen added reviewers: SjoerdMeijer, samtebbs, bipmis, jaykang10.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
dmgreen requested review of this revision.
Herald added a project: LLVM.

This attempts to fold trees of `add(ext(load p), shl(ext(load p+4))` into a single load of twice the size, that we extract the bottom part and top part so that the shl can start to use a shll2 instruction. The two loads in that example can also be larger trees of instructions, which are identical except for the leaves which are all loads offset from the LHS, including buildvectors of multiple loads. For example
sub(zext(buildvec(load p+4, load q+4)), zext(buildvec(load r+4, load s+4)))

Whilst it can be common for the larger loads to replace LDP instructions (which doesn't gain anything on it's own), the larger loads in buildvectors can help create more efficient code, and prevent the need for ld1 lane inserts which can be slower than normal loads.

This creates a fairly niche, fairly large combine that attempts to be fairly general where it is beneficial. It helps some SLP vectorized code to avoid the use of the more expensive ld1 lane inserting loads.


https://reviews.llvm.org/D153972

Files:
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/test/CodeGen/AArch64/extbinopload.ll
  llvm/test/CodeGen/AArch64/extbinopload2.ll
  llvm/test/CodeGen/AArch64/insert-extend.ll
  llvm/test/CodeGen/AArch64/reduce-shuffle.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153972.535371.patch
Type: text/x-patch
Size: 413005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230628/6f0b0a47/attachment-0001.bin>


More information about the llvm-commits mailing list