OSDN Git Service

[DAGCombiner][X86][AArch64][SPARC][SystemZ] y - (x + C) -> (y - x) - C fold
authorRoman Lebedev <lebedev.ri@gmail.com>
Tue, 28 May 2019 17:53:54 +0000 (17:53 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Tue, 28 May 2019 17:53:54 +0000 (17:53 +0000)
commit7728af49e56c39eb08dfda0256d933f4e481cfe5
tree74dc130d8d12b2e1d8a0796f88a9858e05f87d74
parent63a33580333a63e3e8cacde5db552a9e8df36c79
[DAGCombiner][X86][AArch64][SPARC][SystemZ] y - (x + C)  ->  (y - x) - C  fold

Summary:
Direct sibling of D62223 patch.
While i don't have a direct motivational pattern for this,
it would seem to make sense to handle both patterns (or none),
for symmetry?

The aarch64 changes look neutral;
sparc and systemz look like improvement (one less instruction each);
x86 changes - 32bit case improves, 64bit case shows that LEA no longer
gets constructed, which may be because that whole test is `-mattr=+slow-lea,+slow-3ops-lea`

https://rise4fun.com/Alive/ffh

Reviewers: RKSimon, craig.topper, spatel, t.p.northover

Reviewed By: t.p.northover

Subscribers: t.p.northover, jyknight, javed.absar, kristof.beyls, fedor.sergeev, jrtc27, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361853 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/AArch64/shift-amount-mod.ll
test/CodeGen/AArch64/sink-addsub-of-const.ll
test/CodeGen/SPARC/2013-05-17-CallFrame.ll
test/CodeGen/SystemZ/alloca-03.ll
test/CodeGen/X86/sink-addsub-of-const.ll