[PATCH] D131093: [LV] Restructure isPredicatedInst and isScalarWithPredication (w/a fix for uniform mem ops)

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 12:36:22 PDT 2022


reames created this revision.
reames added reviewers: fhahn, david-arm.
Herald added subscribers: frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, bollu, JDevlieghere, simoncook, johnrusso, rbar, asb, hiraditya, mcrosier.
Herald added a project: All.
reames requested review of this revision.
Herald added subscribers: alextsao1999, pcwang-thead, MaskRay.
Herald added a project: LLVM.

This change reorganizes the code and comments to make the expected semantics of these routines more clear.  However, this is *not* an NFC change.  The functional change is having isScalarWithPredication return false if the instruction does not need predicated.  Specifically, for the case of a uniform memory operation we were previously considering it *not* to be a predicated instruction, but *were* considering it to be scalable with predication.

As can be seen with the test changes, this causes uniform memory ops which should have been lowered as uniform-per-parts values to instead be lowering via naive scalarization or if scalarization is infeasible (i.e. scalable vectors) aborted entirely.

I also don't trust the code to bail out correctly 100% of the time, so it's possible we had a crash or miscompile from trying to scalarize something which isn't scalaralizable.  I haven't found a concrete example here, but I am suspicious.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131093

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/RISCV/uniform-load-store.ll
  llvm/test/Transforms/LoopVectorize/first-order-recurrence-sink-replicate-region.ll
  llvm/test/Transforms/LoopVectorize/pr46525-expander-insertpoint.ll
  llvm/test/Transforms/LoopVectorize/vplan-sink-scalars-and-merge.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131093.449738.patch
Type: text/x-patch
Size: 16914 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220803/76c96175/attachment.bin>


More information about the llvm-commits mailing list