Skip to content

Conversation

@rampitec
Copy link
Collaborator

@rampitec rampitec commented Dec 3, 2025

No description provided.

@rampitec
Copy link
Collaborator Author

rampitec commented Dec 3, 2025

@llvmbot
Copy link
Member

llvmbot commented Dec 3, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Stanislav Mekhanoshin (rampitec)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/170395.diff

2 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/SIInstrInfo.cpp (+2-1)
  • (modified) llvm/test/CodeGen/AMDGPU/hazard-gfx1250-flat-scr-hi.mir (+13)
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp index 50860a9a8e4c1..088533306c79b 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp @@ -6260,7 +6260,8 @@ bool SIInstrInfo::isLegalRegOperand(const MachineInstr &MI, unsigned OpIdx, if (ST.hasFlatScratchHiInB64InstHazard() && MO.getReg() == AMDGPU::SRC_FLAT_SCRATCH_BASE_HI && isSALU(MI)) { if (const MachineOperand *Dst = getNamedOperand(MI, AMDGPU::OpName::sdst)) { - if (AMDGPU::getRegBitWidth(*MRI.getRegClass(Dst->getReg())) == 64) + if (AMDGPU::getRegBitWidth(*RI.getRegClassForReg(MRI, Dst->getReg())) == + 64) return false; } if (Opc == AMDGPU::S_BITCMP0_B64 || Opc == AMDGPU::S_BITCMP1_B64) diff --git a/llvm/test/CodeGen/AMDGPU/hazard-gfx1250-flat-scr-hi.mir b/llvm/test/CodeGen/AMDGPU/hazard-gfx1250-flat-scr-hi.mir index e661b6859e09d..e3b28c5518695 100644 --- a/llvm/test/CodeGen/AMDGPU/hazard-gfx1250-flat-scr-hi.mir +++ b/llvm/test/CodeGen/AMDGPU/hazard-gfx1250-flat-scr-hi.mir @@ -143,3 +143,16 @@ body: | %0:sreg_32 = COPY $src_flat_scratch_base_hi %1:sreg_64 = S_BITSET1_B64 %0, undef %1:sreg_64, implicit-def $scc ... + +--- +name: s_ashr_i64_phys_dst +tracksRegLiveness: true +body: | + bb.0: + + ; GCN-LABEL: name: s_ashr_i64_phys_dst + ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $src_flat_scratch_base_hi + ; GCN-NEXT: $sgpr0_sgpr1 = S_ASHR_I64 undef %1:sreg_64, [[COPY]], implicit-def $scc + %0:sreg_32 = COPY $src_flat_scratch_base_hi + $sgpr0_sgpr1 = S_ASHR_I64 undef %1:sreg_64, %0, implicit-def $scc +... 
Copy link
Contributor

@shiltian shiltian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MIR's doesn't account for phys reg while RI's does? These interfaces are confusing…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants