[llvm-branch-commits] [llvm] [AMDGPU] Set inst_pref_size to maximum	(PR #126981)
    Stanislav Mekhanoshin via llvm-branch-commits 
    llvm-branch-commits at lists.llvm.org
       
    Thu Feb 13 01:52:03 PST 2025
    
    
  
================
@@ -199,3 +201,28 @@ const MCExpr *SIProgramInfo::getPGMRSrc2(CallingConv::ID CC,
 
   return MCConstantExpr::create(0, Ctx);
 }
+
+uint64_t SIProgramInfo::getFunctionCodeSize(const MachineFunction &MF) {
+  if (!CodeSizeInBytes.has_value()) {
+    const GCNSubtarget &STM = MF.getSubtarget<GCNSubtarget>();
+    const SIInstrInfo *TII = STM.getInstrInfo();
+
+    uint64_t CodeSize = 0;
+
+    for (const MachineBasicBlock &MBB : MF) {
+      for (const MachineInstr &MI : MBB) {
+        // TODO: CodeSize should account for multiple functions.
+
+        // TODO: Should we count size of debug info?
+        if (MI.isDebugInstr())
----------------
rampitec wrote:
That said, the function was simply moved as is, the only added functionality is caching. And yes. it is incorrect and always was, at least because it does not correctly handle inline asm.
https://github.com/llvm/llvm-project/pull/126981
    
    
More information about the llvm-branch-commits
mailing list