[all-commits] [llvm/llvm-project] 1123d2: [RISCV] Improve shrinkDemandedConstant. (#196585)

Craig Topper via All-commits all-commits at lists.llvm.org
Mon Jun 1 15:30:21 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1123d2bd380e6524dce0f9c09e010b8a3e80a7fa
      https://github.com/llvm/llvm-project/commit/1123d2bd380e6524dce0f9c09e010b8a3e80a7fa
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2026-06-01 (Mon, 01 Jun 2026)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/clmulh.ll
    M llvm/test/CodeGen/RISCV/imm.ll
    M llvm/test/CodeGen/RISCV/rv64i-demanded-bits.ll
    M llvm/test/CodeGen/RISCV/rv64p.ll
    M llvm/test/CodeGen/RISCV/rv64zbkb.ll
    M llvm/test/CodeGen/RISCV/sextw-removal.ll

  Log Message:
  -----------
  [RISCV] Improve shrinkDemandedConstant. (#196585)

Teach shrinkDemandedConstant to restore a constant that can be
materialized as:
  lui a0, hi20
  addi(w) a0, a0, lo12
  slli a1, a0, 32
  add a0, a0, a1

or:
  lui a0, hi20
  addi(w) a0, a0, lo12
  pack a0, a0, a0

This fixes a regression between clang 18 and 19 on this test case
https://godbolt.org/z/Ma746a8xP



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list