[all-commits] [llvm/llvm-project] 1ac845: [GlobalISel] Simplify G_ADD when it has (0-X) on t...

Jessica Paquette via All-commits all-commits at lists.llvm.org
Mon Jun 15 09:43:48 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 1ac8451a9b1e27542e1783e7367a62ca3e47dcc5
      https://github.com/llvm/llvm-project/commit/1ac8451a9b1e27542e1783e7367a62ca3e47dcc5
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2020-06-15 (Mon, 15 Jun 2020)

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

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

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.

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




More information about the All-commits mailing list