[PATCH] D77453: [GlobalISel] Simplify G_ADD when it has (0-X) on the LHS or RHS

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 3 20:34:37 PDT 2020


paquette created this revision.
paquette added reviewers: aemerson, arsenm, dsanders.
Herald added subscribers: danielkiss, volkan, hiraditya, kristof.beyls, rovka, wdng.

This implements the following combines:

((0-A) + B) -> B-A
(A + (0-B)) -> A-B

Porting over the basic algebraic combines from the DAGCombiner. There are several combines which fold adds away into subtracts. This is just the simplest one.

I noticed that add combines are some of the most commonly hit across CTMark, (via print statements when they fire), so I'm porting over some of the obvious ones.

This gives some minor code size improvements on CTMark at -O3 on AArch64.


https://reviews.llvm.org/D77453

Files:
  llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
  llvm/include/llvm/Target/GlobalISel/Combine.td
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-simplify-add.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77453.254994.patch
Type: text/x-patch
Size: 5153 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200404/896416f6/attachment-0001.bin>


More information about the llvm-commits mailing list