Skip to content

Commit bc4f05d

Browse files
authored
[AMDGPU] Early bail in getFunctionCodeSize for meta inst. NFC. (#127129)
It does not change the estimate because getInstSizeInBytes() already returns 0 for meta instructions, but added a test and early bail.
1 parent 2b71df5 commit bc4f05d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

llvm/lib/Target/AMDGPU/SIProgramInfo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,7 @@ uint64_t SIProgramInfo::getFunctionCodeSize(const MachineFunction &MF) {
215215
for (const MachineInstr &MI : MBB) {
216216
// TODO: CodeSize should account for multiple functions.
217217

218-
// TODO: Should we count size of debug info?
219-
if (MI.isDebugInstr())
218+
if (MI.isMetaInstruction())
220219
continue;
221220

222221
CodeSize += TII->getInstSizeInBytes(MI);

llvm/test/CodeGen/AMDGPU/code-size-estimate.mir

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,16 @@ body: |
1818
$vgpr16 = V_MOV_B32_indirect_read undef $vgpr1, implicit $exec, implicit $m0, implicit $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15
1919
V_MOV_B32_indirect_write undef $vgpr0, undef $vgpr3, implicit $exec, implicit $m0, implicit-def $vgpr0_vgpr1_vgpr2_vgpr3, implicit killed $vgpr0_vgpr1_vgpr2_vgpr3(tied-def 4)
2020
...
21+
22+
# CHECK: meta: ; @meta
23+
# CHECK: ; wave barrier
24+
# CHECK: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; encoding: [0x00,0x00,0x8c,0xbf]
25+
# CHECK: ; codeLenInByte = 4
26+
---
27+
name: meta
28+
tracksRegLiveness: true
29+
body: |
30+
bb.0:
31+
32+
WAVE_BARRIER
33+
...

0 commit comments

Comments
 (0)