[PATCH] D45733: [DAGCombiner] Unfold scalar masked merge if profitable

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 17 11:54:16 PDT 2018


lebedev.ri created this revision.
lebedev.ri added reviewers: spatel, craig.topper, RKSimon.
lebedev.ri edited the summary of this revision.

This is PR37104 <https://bugs.llvm.org/show_bug.cgi?id=37104>.

PR6773 <https://bugs.llvm.org/show_bug.cgi?id=6773> will introduce an IR canonicalization that is likely bad for the end assembly.
Previously, `andl`+`andn`/`andps`+`andnps` / `bic`/`bsl` would be generated. (see `@out`)
Now, they would no longer be generated  (see `@in`).
So we need to make sure that they are still generated.

If the mask is constant, right now i always unfold it.
Else, i use `hasAndNot()` TLI hook.

For now, only handle scalars.

https://rise4fun.com/Alive/bO6

----

I *really* don't like the code i wrote in `DAGCombiner::unfoldMaskedMerge()`.
It is super fragile. Is there something like IR Pattern Matchers for this?


Repository:
  rL LLVM

https://reviews.llvm.org/D45733

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/AArch64/unfold-masked-merge-scalar.ll
  test/CodeGen/X86/unfold-masked-merge-scalar.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45733.142809.patch
Type: text/x-patch
Size: 28590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180417/28393917/attachment.bin>


More information about the llvm-commits mailing list