[PATCH] D46031: [DAGCombiner] Masked merge: if 'B' is constant, de-canonicalize the pattern (invert the mask).

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 30 13:10:51 PDT 2018


lebedev.ri updated this revision to Diff 144618.
lebedev.ri added a comment.

After some thought, and staring into MCA output, i believe this should come before De Morgan laws (https://reviews.llvm.org/D46073, should that ever land),
thus i rebased this change not to depend on that differential.

Some considerations, for znver1, and this test IR:

  define i32 @in_constant_varx_42(i32 %x, i32 %y, i32 %mask) {
    %n0 = xor i32 %x, 42 ; %x
    %n1 = and i32 %n0, %mask
    %r = xor i32 %n1, 42
    ret i32 %r
  }

F6070355: diff-mm-vs-unfolded-old.txt <https://reviews.llvm.org/F6070355> Difference between not unfolding that pattern vs. svn - instruction count and IPC increased

F6070331: diff-mm-vs-unfolded-new.txt <https://reviews.llvm.org/F6070331> Difference between not unfolding that pattern vs. this differential - Total Cycles halved, IPC doubled

F6070336: diff-unfolded-old-vs-new.txt <https://reviews.llvm.org/F6070336> Difference between unfolding that pattern in svn vs. this differential - Instruction count decreased back to not unfolded count, cycle count halved, IPC increased.


Repository:
  rL LLVM

https://reviews.llvm.org/D46031

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46031.144618.patch
Type: text/x-patch
Size: 6232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180430/754e0456/attachment.bin>


More information about the llvm-commits mailing list