[all-commits] [llvm/llvm-project] 0b1695: [RISCV] Don't transfer (select c, t, f) to Zicond ...

Jim Lin via All-commits all-commits at lists.llvm.org
Mon Jul 20 22:47:20 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0b16957f41f96f14aa014f119e4180538bcb4f80
      https://github.com/llvm/llvm-project/commit/0b16957f41f96f14aa014f119e4180538bcb4f80
  Author: Jim Lin <jim at andestech.com>
  Date:   2026-07-21 (Tue, 21 Jul 2026)

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

  Log Message:
  -----------
  [RISCV] Don't transfer (select c, t, f) to Zicond when optimizing for size (#163501)

The Zicond form of (select c, t, f), (or (czero_eqz t, c),
(czero_nez f, c)), has no compressed encodings and is always 12 bytes.
The branch form (branch + mv) is at most 8 bytes, and with the C
extension
4 bytes when the branch compresses (c.mv always does) or 6 bytes when it
does not; it shrinks further when a condition is shared across selects.
Since it is never larger by byte count, skip the Zicond transform under
optsize via !DAG.shouldOptForSize().

Fixes https://github.com/llvm/llvm-project/issues/158633.



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