[all-commits] [llvm/llvm-project] 5467e5: [RISCV] Generate landing pad based on cf-protectio...

Kito Cheng via All-commits all-commits at lists.llvm.org
Thu Apr 16 08:28:23 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5467e556a3756304e5c9a8aa93e309da755eff28
      https://github.com/llvm/llvm-project/commit/5467e556a3756304e5c9a8aa93e309da755eff28
  Author: Kito Cheng <kito.cheng at sifive.com>
  Date:   2026-04-16 (Thu, 16 Apr 2026)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVCallingConv.cpp
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/lib/Target/RISCV/RISCVIndirectBranchTracking.cpp
    M llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
    M llvm/lib/Target/RISCV/RISCVInstrInfo.td
    M llvm/lib/Target/RISCV/RISCVLandingPadSetup.cpp
    M llvm/lib/Target/RISCV/RISCVMachineFunctionInfo.cpp
    M llvm/lib/Target/RISCV/RISCVMachineFunctionInfo.h
    M llvm/test/CodeGen/RISCV/GlobalISel/instruction-select/brindirect-rv32.mir
    M llvm/test/CodeGen/RISCV/GlobalISel/instruction-select/brindirect-rv64.mir
    M llvm/test/CodeGen/RISCV/GlobalISel/irtranslator/calls.ll
    M llvm/test/CodeGen/RISCV/branch-relaxation-rv32.ll
    M llvm/test/CodeGen/RISCV/branch-relaxation-rv64.ll
    A llvm/test/CodeGen/RISCV/calls-cf-branch.ll
    M llvm/test/CodeGen/RISCV/calls.ll
    A llvm/test/CodeGen/RISCV/cf-branch-isel.ll
    M llvm/test/CodeGen/RISCV/jumptable-swguarded.ll
    M llvm/test/CodeGen/RISCV/kcfi-isel-mir.ll
    M llvm/test/CodeGen/RISCV/lpad.ll
    M llvm/test/CodeGen/RISCV/machine-outliner-call-reg-live-across.mir
    M llvm/test/CodeGen/RISCV/nest-register.ll
    M llvm/test/CodeGen/RISCV/opt-w-instrs.mir
    M llvm/test/CodeGen/RISCV/pr97304.ll
    M llvm/test/CodeGen/RISCV/tail-calls.ll
    M llvm/test/CodeGen/RISCV/zicfilp-indirect-branch.ll

  Log Message:
  -----------
  [RISCV] Generate landing pad based on cf-protection-branch flag only (#179960)

Previously, the backend generated lpad instructions when the Zicfilp
extension was enabled. This patch changes the behavior to generate lpad
instructions only when the cf-protection-branch module flag is set
(typically from -fcf-protection=branch).

This aligns with the Clang frontend's intent, which has a comment saying
"Always generate Zicfilp lpad insns, Non-zicfilp CPUs would read them as
NOP".

The Zicfilp extension is no longer required for lpad generation - only
the module flag matters. Tests that previously used
-mattr=+experimental-zicfilp to trigger lpad generation now use the
cf-protection-branch module flag.

Additionally, the selection of NonX7 variants for indirect
branches/calls is now based on the cf-protection-branch module flag
instead of the Zicfilp extension. This ensures consistent behavior: when
cf-protection-branch is enabled, X7 is reserved for landing pad labels
and cannot be used for indirect branch/call target addresses.



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