[PATCH] D94074: [AArch64][SVE] Remove chains of unnecessary SVE reinterpret intrinsics

Joe Ellis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 5 02:32:05 PST 2021


joechrisellis created this revision.
joechrisellis added reviewers: kmclaughlin, david-arm, peterwaller-arm, bsmith.
Herald added subscribers: NickHung, psnobl, hiraditya, kristof.beyls, tschuett.
Herald added a reviewer: efriedma.
joechrisellis requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This commit extends SVEIntrinsicOpts::optimizeConvertFromSVBool to
identify and remove longer chains of redundant SVE reintepret
intrinsics. For example, the following chain of redundant SVE
reinterprets is now recognised as redundant:

  %a = <vscale x 2 x i1>
  %1 = <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool(<vscale x 2 x i1> %a)
  %2 = <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool(<vscale x 16 x i1> %1)
  %3 = <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool(<vscale x 4 x i1> %2)
  %4 = <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool(<vscale x 16 x i1> %3)
  %5 = <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool(<vscale x 4 x i1> %4)
  %6 = <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool(<vscale x 16 x i1> %5)
  ret <vscale x 2 x i1> %6

and will be replaced with:

  ret <vscale x 2 x i1> %a

Eliminating these can sometimes mean emitting fewer unnecessary
loads/stores when lowering to assembly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94074

Files:
  llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp
  llvm/test/CodeGen/AArch64/sve-intrinsic-opts-reinterpret.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94074.314551.patch
Type: text/x-patch
Size: 5952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210105/4f40c682/attachment.bin>


More information about the llvm-commits mailing list