[llvm] [AMDGPU] Do not fold an immediate into instructions with frame indexes (PR #151263)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 5 09:59:23 PDT 2025
================
@@ -6120,10 +6120,11 @@ bool SIInstrInfo::isOperandLegal(const MachineInstr &MI, unsigned OpIdx,
!Op.isIdenticalTo(*MO))
return false;
- // Do not fold a frame index into an instruction that already has a frame
- // index. The frame index handling code doesn't handle fixing up operand
- // constraints if there are multiple indexes.
- if (Op.isFI() && MO->isFI())
+ // Do not fold a frame index or an immediate into an instruction that
+ // already has a frame index. The frame index handling code doesn't handle
+ // fixing up operand constraints if there are multiple indexes, and a
+ // frame index could possibly turn out to be another immediate.
+ if (Op.isFI() && (MO->isFI() || MO->isImm()))
----------------
arsenm wrote:
This probably should be !isReg, the same issue probably exists for any exotic operand types
https://github.com/llvm/llvm-project/pull/151263
More information about the llvm-commits
mailing list