[llvm] [AMDGPU] Explicit instruction prefetch for large entry functions (PR #227995)

Lukas Sommer via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 09:50:30 PDT 2026


================
@@ -226,17 +226,26 @@ uint64_t SIProgramInfo::getFunctionCodeSize(const MachineFunction &MF) {
 
   for (const MachineBasicBlock &MBB : MF) {
     CodeSize = alignTo(CodeSize, MBB.getAlignment());
+    CodeSize += getMachineBasicBlockCodeSize(MBB, *TII);
+  }
+
+  CodeSizeInBytes = CodeSize;
+  return CodeSize;
+}
+
+uint64_t
+SIProgramInfo::getMachineBasicBlockCodeSize(const MachineBasicBlock &MBB,
----------------
sommerlukas wrote:

For this use case, the estimate does not need to be 100% accurate, as we include some slack and finalize the size during fixup, where the final code size is precisely known.

Or do you mean we shouldn't expose the `getMachineBasicBlockCodeSize` function?

https://github.com/llvm/llvm-project/pull/227995


More information about the llvm-commits mailing list