OSDN Git Service

[DAGCombiner] Combine OR as ADD when no common bits are set
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Tue, 23 Apr 2019 10:01:08 +0000 (10:01 +0000)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Tue, 23 Apr 2019 10:01:08 +0000 (10:01 +0000)
commit734bf57ca8725984ccc2a04df6f8aeaea40a9e3f
tree34e44c6bd82297d80d6f29931a8b4eb7af1b962a
parente86c537628d85e9bff9ffb63e29be2467909b348
[DAGCombiner] Combine OR as ADD when no common bits are set

Summary:
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.

Reviewers: spatel, RKSimon, craig.topper, kparzysz

Reviewed By: spatel

Subscribers: arsenm, rampitec, lebedev.ri, jvesely, nhaehnle, hiraditya, javed.absar, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D59758

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358965 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/AMDGPU/calling-conventions.ll
test/CodeGen/AMDGPU/cvt_f32_ubyte.ll
test/CodeGen/AMDGPU/sminmax.v2i16.ll
test/CodeGen/AMDGPU/widen-smrd-loads.ll
test/CodeGen/Hexagon/subi-asl.ll
test/CodeGen/X86/scheduler-backtracking.ll
test/CodeGen/X86/signbit-shift.ll
test/CodeGen/X86/split-store.ll