[all-commits] [llvm/llvm-project] a2de12: [RISCV] Relax a one use restriction performSRACombine

Craig Topper via All-commits all-commits at lists.llvm.org
Thu Aug 4 11:25:47 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a2de12c987339f228f7fa412222f7e7746e220ed
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-08-04 (Thu, 04 Aug 2022)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/rv64i-shift-sext.ll

  Log Message:
  [RISCV] Relax a one use restriction performSRACombine

When folding (sra (add (shl X, 32), C1), 32 - C) -> (shl (sext_inreg (add X, C1), C)
ignore the use count on the (shl X, 32).

The sext_inreg after the transform is free. So we're only making
2 new instructions, the add and the shl. So we only need to be
concerned with replacing the original sra+add. The original shl
can have other uses. This helps if there are multiple different
constants being added to the same shl.

More information about the All-commits mailing list