[PATCH] D48301: DAG combine "and|or (select c, -1, 0), x" -> "select c, x, 0|-1"

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 18 15:15:06 PDT 2018


rampitec created this revision.
rampitec added reviewers: spatel, msearles.
Herald added subscribers: tpr, nhaehnle.

Allowed folding for "and/or" binops with non-constant operand if
arguments of select are 0/-1 values.

Normally this code with "and" opcode does not get to a DAG combiner
and simplified yet in the InstCombine. However AMDGPU produces it
during lowering and InstCombine has no chance to optimize it out.

In turn the same pattern with "or" opcode can reach DAG.

Diff against https://reviews.llvm.org/D48223


https://reviews.llvm.org/D48301

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/AMDGPU/dagcombine-select.ll
  test/CodeGen/AMDGPU/udivrem.ll
  test/CodeGen/X86/dagcombine-select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48301.151803.patch
Type: text/x-patch
Size: 9278 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180618/90939b7c/attachment-0001.bin>


More information about the llvm-commits mailing list