[llvm] bc4f05d - [AMDGPU] Early bail in getFunctionCodeSize for meta inst. NFC. (#127129)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 18 02:08:31 PST 2025
Author: Stanislav Mekhanoshin
Date: 2025-02-18T02:08:28-08:00
New Revision: bc4f05d8a8a4f908252aba9444571de4398d4288
URL: https://github.com/llvm/llvm-project/commit/bc4f05d8a8a4f908252aba9444571de4398d4288
DIFF: https://github.com/llvm/llvm-project/commit/bc4f05d8a8a4f908252aba9444571de4398d4288.diff
LOG: [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.
Added:
Modified:
llvm/lib/Target/AMDGPU/SIProgramInfo.cpp
llvm/test/CodeGen/AMDGPU/code-size-estimate.mir
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/SIProgramInfo.cpp b/llvm/lib/Target/AMDGPU/SIProgramInfo.cpp
index 5179288084010..1123696509818 100644
--- a/llvm/lib/Target/AMDGPU/SIProgramInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIProgramInfo.cpp
@@ -215,8 +215,7 @@ uint64_t SIProgramInfo::getFunctionCodeSize(const MachineFunction &MF) {
for (const MachineInstr &MI : MBB) {
// TODO: CodeSize should account for multiple functions.
- // TODO: Should we count size of debug info?
- if (MI.isDebugInstr())
+ if (MI.isMetaInstruction())
continue;
CodeSize += TII->getInstSizeInBytes(MI);
diff --git a/llvm/test/CodeGen/AMDGPU/code-size-estimate.mir b/llvm/test/CodeGen/AMDGPU/code-size-estimate.mir
index 9e46c58b6b5a9..76eaf350301e4 100644
--- a/llvm/test/CodeGen/AMDGPU/code-size-estimate.mir
+++ b/llvm/test/CodeGen/AMDGPU/code-size-estimate.mir
@@ -18,3 +18,16 @@ body: |
$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
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)
...
+
+# CHECK: meta: ; @meta
+# CHECK: ; wave barrier
+# CHECK: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) ; encoding: [0x00,0x00,0x8c,0xbf]
+# CHECK: ; codeLenInByte = 4
+---
+name: meta
+tracksRegLiveness: true
+body: |
+ bb.0:
+
+ WAVE_BARRIER
+...
More information about the llvm-commits
mailing list