[all-commits] [llvm/llvm-project] e8b9c1: [RISCV] Don't truncate MaxAlignment to int when re...

Divyansh Yadav via All-commits all-commits at lists.llvm.org
Fri Oct 2 19:24:21 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e8b9c1990a691bee7b42db18936e1c2892de6e68
      https://github.com/llvm/llvm-project/commit/e8b9c1990a691bee7b42db18936e1c2892de6e68
  Author: Divyansh Yadav <anshmcs at gmail.com>
  Date:   2026-10-02 (Fri, 02 Oct 2026)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
    A llvm/test/CodeGen/RISCV/pr228084.ll

  Log Message:
  -----------
  [RISCV] Don't truncate MaxAlignment to int when realigning the stack (#228225)

emitPrologue casts MaxAlignment to int before checking whether the mask
fits in an ANDI immediate. With an alloca of align 4294967296 the cast
gives 0, the isInt<12> check passes, and we emit `andi sp, sp, 0`.
Casting to int64_t instead makes this case use the srli/slli sequence.

This is the patch Mitch Briles posted on the issue, but with int64_t
instead of long, since long is only 32 bits on Windows hosts.

The test is RV64 only. On RV32 this alignment already fails with "Should
only materialize 32-bit constants for RV32" while setting up the frame
(before and after this change), so it couldn't go into
stack-realignment.ll alongside the RV32 run lines.

Fixes #228084

Co-authored-by: Mitch Briles <mitchbriles at gmail.com>



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