[PATCH] D43058: [LV][near-NFC] move isLegalMasked* from LoopVectorizationLegality to LoopVectorizationCostModel

Hideki Saito via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 18:19:08 PST 2018


hsaito created this revision.
hsaito added reviewers: aemerson, hfinkel, mkuper, fhahn, rengolin.
Herald added a subscriber: llvm-commits.

Please see RFC http://lists.llvm.org/pipermail/llvm-dev/2018-January/120164.html and follow up discussions for details.

Decision on whether to allow emulated masked load/store in loop vectorization is moved from legality to cost model
since it actually is a cost model question.

As I have suspected, cost model for emulated masked load/store doesn't seem to be reasonable.
We were allowing only one emulated masked store, and with very favorable cost model (i.e., cost is super low in my opinion).

As such, I've added cost model hacks to make the patch reasonably near NFC. It should result in the same cost model
computation as before for the cases where the loop was previously considered legal. The cost is artificially very high for
the cases where the loop was previously dropped from vectorization.

Move of isLegalMasked*() should be no-brainer. More controversial aspect of this patch is the cost model "hack"
to make this nearly NFC. If you do not like how it is done, please suggest constructive alternatives. Please do not
make "tune the cost model correctly" as a requirement for this patch to go in. That's a totally different activity from
making LV's architecture more modular. I hope somebody else can work on it.

Previous Steps in making LV more modular.
https://reviews.llvm.org/D41045
https://reviews.llvm.org/D41420


Repository:
  rL LLVM

https://reviews.llvm.org/D43058

Files:
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopVectorize/conditional-assignment.ll
  test/Transforms/LoopVectorize/hoist-loads.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43058.133348.patch
Type: text/x-patch
Size: 16770 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180208/850ebd0b/attachment.bin>


More information about the llvm-commits mailing list