OSDN Git Service

[DAGCombine][X86][AArch64][MIPS][LANAI] (C - x) - y -> C - (x + y) fold (PR41952)
authorRoman Lebedev <lebedev.ri@gmail.com>
Tue, 4 Jun 2019 11:06:21 +0000 (11:06 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Tue, 4 Jun 2019 11:06:21 +0000 (11:06 +0000)
commit4c668f9d5bb6ebbd6fa443c5a1c484be35e1e439
tree8ce8f67100fc7a881f9258fb7fdcb0b5f77ca8cb
parente270352fc37116d93b83b10e10c60901f2a9c7e1
[DAGCombine][X86][AArch64][MIPS][LANAI] (C - x) - y  ->  C - (x + y) fold (PR41952)

Summary:
This *might* be the last fold for `sink-addsub-of-const.ll`, but i'm not sure yet.

As far as i can tell, there are no regressions here (ignoring x86-32),
all changes are either good or neutral.

This, almost surprisingly to me, fixes the motivational tests (in `shift-amount-mod.ll`)
`@reg32_lshr_by_sub_from_negated` from [[ https://bugs.llvm.org/show_bug.cgi?id=41952 | PR41952 ]].

https://rise4fun.com/Alive/vMd3

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

Reviewed By: RKSimon

Subscribers: sdardis, javed.absar, arichardson, kristof.beyls, jrtc27, atanasyan, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362488 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/Lanai/constant_multiply.ll
test/CodeGen/Mips/const-mult.ll
test/CodeGen/Mips/madd-msub.ll
test/CodeGen/X86/shift-amount-mod.ll
test/CodeGen/X86/sink-addsub-of-const.ll