[PATCH] D73703: [InstCombine] reassociate splatted vector ops

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 06:31:08 PST 2020


spatel created this revision.
spatel added reviewers: nikic, lebedev.ri, efriedma, RKSimon.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.

bo (splat X), (bo Y, OtherOp) --> bo (splat (bo X, Y)), OtherOp

This patch depends on the splat analysis enhancement in D73549 <https://reviews.llvm.org/D73549>. See the test with comment:

  ; Negative test - mismatched splat elements

...as the motivation for that first patch. If anyone sees a better way, I'm open to suggestions.

The motivating case for reassociating splatted ops is shown in PR42174:
https://bugs.llvm.org/show_bug.cgi?id=42174

In that example, a slight change in order-of-associative math results in a big difference in IR and codegen. This patch gets all of the unnecessary shuffles out of the way, but doesn't address the potential scalarization (see D50992 <https://reviews.llvm.org/D50992> or D73480 <https://reviews.llvm.org/D73480> for that).


https://reviews.llvm.org/D73703

Files:
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/test/Transforms/InstCombine/vec_shuffle.ll
  llvm/test/Transforms/LoopVectorize/induction.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73703.241433.patch
Type: text/x-patch
Size: 7469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200130/692c8c9c/attachment.bin>


More information about the llvm-commits mailing list