[PATCH] D149654: [SLP] Don't cost pointers that can be folded in getPointersChainCost

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 2 07:51:19 PDT 2023


luke created this revision.
luke added reviewers: ABataev, RKSimon, reames.
Herald added subscribers: asb, vporpo, pmatos, frasercrmck, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
luke requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, MaskRay.
Herald added a project: LLVM.

If a pointer chain is unit-strided and the distance between the base
pointer plus the offset is a legal addressing mode, then the address
computation for that pointer will be folded into the memory instruction,
so don't include it in the cost.
x86 was already accounting for this, so this generalizes it across all
targets.
This prevents some unprofitable cases from being SLP vectorized on
RISC-V by making the scalar costs cheaper and closer to the actual
codegen.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149654

Files:
  llvm/include/llvm/Analysis/TargetTransformInfo.h
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/lib/Target/X86/X86TargetTransformInfo.cpp
  llvm/lib/Target/X86/X86TargetTransformInfo.h
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
  llvm/test/Transforms/SLPVectorizer/RISCV/struct-gep.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149654.518734.patch
Type: text/x-patch
Size: 9006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230502/ce1e3d57/attachment.bin>


More information about the llvm-commits mailing list