[PATCH] D62774: [DAGCombine][X86][AArch64][MIPS][LANAI] (C - x) - y -> C - (x + y) fold (PR41952)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 1 05:53:54 PDT 2019


lebedev.ri created this revision.
lebedev.ri added reviewers: RKSimon, t.p.northover, craig.topper, spatel, eli.friedman.
lebedev.ri added a project: LLVM.
Herald added subscribers: atanasyan, jrtc27, kristof.beyls, arichardson, javed.absar, sdardis.
lebedev.ri added a parent revision: D62266: [DAGCombine][X86][AArch64][ARM] (C - x) + y  ->  (y - x) + C  fold.

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 PR41952 <https://bugs.llvm.org/show_bug.cgi?id=41952>.

https://rise4fun.com/Alive/vMd3


Repository:
  rL LLVM

https://reviews.llvm.org/D62774

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62774.202546.patch
Type: text/x-patch
Size: 11692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190601/7e4e48b7/attachment.bin>


More information about the llvm-commits mailing list