]> granicus.if.org Git - llvm/commit
[DAGCombiner][X86][AArch64][SPARC][SystemZ] y - (x + C) -> (y - x) - C fold. Try 3
authorRoman Lebedev <lebedev.ri@gmail.com>
Thu, 30 May 2019 20:37:18 +0000 (20:37 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Thu, 30 May 2019 20:37:18 +0000 (20:37 +0000)
commit58c76e2b4efdebc1a5b767c64f6f7e568c17a42b
tree84bb130d4869162079539318c26864c58a7920ab
parent1c91b28c617127e6f25633ca3dcb1eac579d20b9
[DAGCombiner][X86][AArch64][SPARC][SystemZ] y - (x + C)  ->  (y - x) - C  fold. Try 3

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

This is a recommit, originally committed in rL361852, but reverted
to investigate test-suite compile-time hangs, and then reverted in
rL362109 to fix missing constant folds that were causing
endless combine loops.

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@362143 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