[PATCH] D134282: [CGP] Add generic TargetLowering::shouldAlignPointerArgs() implementation

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 06:23:33 PDT 2022


arichardson created this revision.
arichardson added reviewers: craig.topper, john.brawn, hfinkel, rengolin, JojoR, jrtc27.
Herald added subscribers: pmatos, asb, StephenFan, frasercrmck, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, kristof.beyls, jgravelle-google, sbc100, dschuff.
Herald added a project: All.
arichardson requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, MaskRay, aheejin.
Herald added a project: LLVM.

This function was added for ARM targets, but aligning global/stack pointer
arguments passed to memcpy/memmove/memset can improve code size and
performance for all targets that don't have fast unaligned accesses.
This adds a generic implementation that adjusts the alignment to pointer
size if unaligned accesses are slow.
Review D134168 <https://reviews.llvm.org/D134168> suggests that this significantly improves performance on
synthetic benchmarks such as Dhrystone on RV32 as it avoids memcpy() calls.

TODO: It should also improve performance for other benchmarks, would be
good to get some numbers.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134282

Files:
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/CodeGen/TargetLoweringBase.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMISelLowering.h
  llvm/test/CodeGen/BPF/rodata_5.ll
  llvm/test/CodeGen/RISCV/memcpy-inline.ll
  llvm/test/CodeGen/WebAssembly/bulk-memory64.ll
  llvm/test/CodeGen/X86/GlobalISel/x86_64-irtranslator-struct-return.ll
  llvm/test/CodeGen/X86/load-local-v4i5.ll
  llvm/test/Transforms/CodeGenPrepare/RISCV/adjust-memintrin-alignment.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134282.461556.patch
Type: text/x-patch
Size: 19246 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220920/d006606b/attachment.bin>


More information about the llvm-commits mailing list