Skip to content

Commit 83ab875

Browse files
authored
[AMDGPU] Handle phys regs in flat_scratch_base_hi operand check (llvm#170395)
1 parent 271e99d commit 83ab875

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6260,7 +6260,8 @@ bool SIInstrInfo::isLegalRegOperand(const MachineInstr &MI, unsigned OpIdx,
62606260
if (ST.hasFlatScratchHiInB64InstHazard() &&
62616261
MO.getReg() == AMDGPU::SRC_FLAT_SCRATCH_BASE_HI && isSALU(MI)) {
62626262
if (const MachineOperand *Dst = getNamedOperand(MI, AMDGPU::OpName::sdst)) {
6263-
if (AMDGPU::getRegBitWidth(*MRI.getRegClass(Dst->getReg())) == 64)
6263+
if (AMDGPU::getRegBitWidth(*RI.getRegClassForReg(MRI, Dst->getReg())) ==
6264+
64)
62646265
return false;
62656266
}
62666267
if (Opc == AMDGPU::S_BITCMP0_B64 || Opc == AMDGPU::S_BITCMP1_B64)

llvm/test/CodeGen/AMDGPU/hazard-gfx1250-flat-scr-hi.mir

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,16 @@ body: |
143143
%0:sreg_32 = COPY $src_flat_scratch_base_hi
144144
%1:sreg_64 = S_BITSET1_B64 %0, undef %1:sreg_64, implicit-def $scc
145145
...
146+
147+
---
148+
name: s_ashr_i64_phys_dst
149+
tracksRegLiveness: true
150+
body: |
151+
bb.0:
152+
153+
; GCN-LABEL: name: s_ashr_i64_phys_dst
154+
; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $src_flat_scratch_base_hi
155+
; GCN-NEXT: $sgpr0_sgpr1 = S_ASHR_I64 undef %1:sreg_64, [[COPY]], implicit-def $scc
156+
%0:sreg_32 = COPY $src_flat_scratch_base_hi
157+
$sgpr0_sgpr1 = S_ASHR_I64 undef %1:sreg_64, %0, implicit-def $scc
158+
...

0 commit comments

Comments
 (0)