[all-commits] [llvm/llvm-project] b30520: [RISCV] Optimize (add (mul x, c0), c1)

Ben Shi via All-commits all-commits at lists.llvm.org
Tue Sep 21 07:13:37 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b3052013b43617defd777b1f3b4339540c4c07df
      https://github.com/llvm/llvm-project/commit/b3052013b43617defd777b1f3b4339540c4c07df
  Author: Ben Shi <powerman1st at 163.com>
  Date:   2021-09-21 (Tue, 21 Sep 2021)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/addimm-mulimm.ll

  Log Message:
  -----------
  [RISCV] Optimize (add (mul x, c0), c1)

Optimize (add (mul x, c0), c1) -> (ADDI (MUL (ADDI, c1/c0), c0), c1%c0),
if c1/c0 and c1%c0 are simm12, while c1 is not.

Optimize (add (mul x, c0), c1) -> (MUL (ADDI, c1/c0), c0),
if c1%c0 is zero, and c1/c0 is simm12 while c1 is not.

Reviewed By: craig.topper

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




More information about the All-commits mailing list