[all-commits] [llvm/llvm-project] 3f2847: [AMDGPU] Fix S_ADD_I32 frame index folding emittin...

adeshcom14 via All-commits all-commits at lists.llvm.org
Wed Jul 29 20:47:49 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3f28472185bb8df103f2fbf9f3ccc22b62f1fe1c
      https://github.com/llvm/llvm-project/commit/3f28472185bb8df103f2fbf9f3ccc22b62f1fe1c
  Author: adeshcom14 <aadikane at amd.com>
  Date:   2026-07-30 (Thu, 30 Jul 2026)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
    A llvm/test/CodeGen/AMDGPU/eliminate-frame-index-s-add-i32.ll
    M llvm/test/CodeGen/AMDGPU/eliminate-frame-index-s-add-i32.mir

  Log Message:
  -----------
  [AMDGPU] Fix S_ADD_I32 frame index folding emitting COPY with immediate (#212440)

When eliminating a frame index in `S_ADD_I32 %fi, imm`,
`SIRegisterInfo::eliminateFrameIndex` can simplify `0 + offset` into a
COPY or S_MOV_B32. The pass used a `MachineOperand` reference captured
before `removeOperand()`, which becomes stale after operands are removed
and shifted. That caused the wrong opcode to be selected (`COPY` instead
of `S_MOV_B32`), producing invalid machine IR such as `copy s4, 4`.
The invalid COPY is later hit by Machine Copy Propagation, which asserts
when calling `getReg()` on the immediate source operand.

Co-authored-by: Matt Arsenault <Matthew.Arsenault at amd.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