[PATCH] D59758: [DAGCombiner] Combine OR as ADD when no common bits are set

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 02:45:23 PDT 2019


bjope created this revision.
bjope added reviewers: spatel, RKSimon, craig.topper.
Herald added subscribers: javed.absar, hiraditya, nhaehnle, jvesely.
Herald added a project: LLVM.

The DAGCombiner is rewriting (canonicalizing) an ISD::ADD
with no common bits set in the operands as an ISD::OR node.

This could sometimes result in "missing out" on some
combines that normally are performed for ADD. To be more
specific this could happen if we already have rewritten an
ADD into OR, and later (after legalizations or combines)
we expose patterns that could have been optimized if we
had seen the OR as an ADD (e.g. reassociations based on ADD).

To make the DAG combiner less sensitive to if ADD or OR is
used for these "no common bits set" ADD/OR operations we
now apply most of the ADD combines also to an OR operation,
when value tracking indicates that the operands have no
common bits set.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D59758

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/test/CodeGen/AMDGPU/calling-conventions.ll
  llvm/test/CodeGen/AMDGPU/sminmax.v2i16.ll
  llvm/test/CodeGen/AMDGPU/widen-smrd-loads.ll
  llvm/test/CodeGen/Hexagon/subi-asl.ll
  llvm/test/CodeGen/X86/scheduler-backtracking.ll
  llvm/test/CodeGen/X86/signbit-shift.ll
  llvm/test/CodeGen/X86/split-store.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59758.192060.patch
Type: text/x-patch
Size: 17683 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190325/bf8e626e/attachment-0001.bin>


More information about the llvm-commits mailing list