[all-commits] [llvm/llvm-project] 391cbd: Reland [RISCV] Check SP-relative offset in needsFr...

Garvit Gupta via All-commits all-commits at lists.llvm.org
Mon Jun 8 23:50:52 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 391cbd232dfded7d9af778f9a1fdb04982a15a42
      https://github.com/llvm/llvm-project/commit/391cbd232dfded7d9af778f9a1fdb04982a15a42
  Author: Garvit Gupta <garvgupt at qti.qualcomm.com>
  Date:   2026-06-09 (Tue, 09 Jun 2026)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
    M llvm/test/CodeGen/RISCV/GlobalISel/vararg.ll
    M llvm/test/CodeGen/RISCV/local-stack-slot-allocation.ll

  Log Message:
  -----------
  Reland [RISCV] Check SP-relative offset in needsFrameBaseReg when FP offset overflows (#202499)

When a frame pointer is present, needsFrameBaseReg previously only
checked the FP-relative offset to decide if a virtual base register was
needed. If the worst-case FP offset exceeded the 12-bit immediate range,
a base register was always materialized, even when the SP-relative
offset would fit.

Since getFrameIndexReference can now select SP over FP when the offset
fits in the compressed instruction immediate range, also check the
SP-relative offset before deciding a base register is needed. This
avoids unnecessary base register materialization and results in some
code size savings.

Reland of b5d577d3faef.



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