[all-commits] [llvm/llvm-project] 992bee: [RISCV] Teach RISCVSExtWRemoval to remove sext.w w...

Craig Topper via All-commits all-commits at lists.llvm.org
Thu Dec 15 11:01:52 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 992bee045b7586774ffd539bb46d9a1e22896f60
      https://github.com/llvm/llvm-project/commit/992bee045b7586774ffd539bb46d9a1e22896f60
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-12-15 (Thu, 15 Dec 2022)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVSExtWRemoval.cpp
    M llvm/test/CodeGen/RISCV/sextw-removal.ll

  Log Message:
  -----------
  [RISCV] Teach RISCVSExtWRemoval to remove sext.w whose upper bits aren't demanded.

SelectionDAG aggressively creates sext_inreg operations after
promoting an i32 add. If the add is later matched to a sh1add,
sh2add or sh3add, a sext.w from the sext_inreg will get left behind.
In many cases we can prove this sext.w is unnecessary by checking
if its upper bits are ever used.




More information about the All-commits mailing list