[PATCH] D159219: [RISCV] Cost illegally typed insert/extract elements correctly

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 30 11:28:36 PDT 2023


reames created this revision.
reames added reviewers: luke, craig.topper, asb.
Herald added subscribers: jobnoorman, sunshaoce, VincentWu, vkmr, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, bollu, simoncook, johnrusso, rbar, hiraditya, arichardson, mcrosier.
Herald added a project: All.
reames requested review of this revision.
Herald added subscribers: wangpc, eopXD, MaskRay.
Herald added a project: LLVM.

We had been deferring to BasicTTI, and BasicTTI doesn't handle this correctly.  It blindly returns a cost of 1 for each extract and insert.  The net effect of this was that illegal build and explode vectors looked oddly cheap compared to their legal sub types.

Noticed this while playing around with SLP and -riscv-v-fixed-length-vector-lmul-max, but I don't believe this impacts default SLP codegen.

This probably should be sunk into BasicTTI.  I even intend to try to do so after this lands, I just wanted to get the target specific test changes in first.   The sinking into BasicTTI will be easier if it's NFC.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159219

Files:
  llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
  llvm/test/Analysis/CostModel/RISCV/arith-fp.ll
  llvm/test/Analysis/CostModel/RISCV/fixed-vector-gather.ll
  llvm/test/Analysis/CostModel/RISCV/fixed-vector-scatter.ll
  llvm/test/Analysis/CostModel/RISCV/rvv-extractelement.ll
  llvm/test/Analysis/CostModel/RISCV/rvv-insertelement.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159219.554789.patch
Type: text/x-patch
Size: 172884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230830/769dad69/attachment-0001.bin>


More information about the llvm-commits mailing list