[PATCH] D156215: [DAGcombiner] Reassociate the operands from (OR (OR(CMP1, CMP2)), CMP3) to (OR (OR(CMP1, CMP3)), CMP2)

Konstantina Mitropoulou via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 25 01:52:42 PDT 2023


kmitropoulou created this revision.
Herald added subscribers: kerbowa, pengfei, hiraditya, jvesely.
Herald added a project: All.
kmitropoulou requested review of this revision.
Herald added subscribers: llvm-commits, wangpc.
Herald added a project: LLVM.

and (AND (AND(CMP1, CMP2)), CMP3) to (AND (AND(CMP1, CMP3)), CMP2) when CMP1 and
CMP3 have the same predicate (or CMP2 and CMP3 have the same predicate).

This helps optimizations such as the fololowing one:
CMP(A,C)||CMP(B,C) => CMP(MIN/MAX(A,B), C)
CMP(A,C)&&CMP(B,C) => CMP(MIN/MAX(A,B), C)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156215

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/test/CodeGen/AMDGPU/combine_andor_with_cmps.ll
  llvm/test/CodeGen/AMDGPU/wave32.ll
  llvm/test/CodeGen/Hexagon/isel/logical.ll
  llvm/test/CodeGen/X86/v8i1-masks.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156215.543868.patch
Type: text/x-patch
Size: 12645 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230725/b067bee2/attachment.bin>


More information about the llvm-commits mailing list