[llvm] [AMDGPU] Defer emitting AMDGPUAsmPrinter local Resource Usage comments until the end (PR #198233)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 03:34:59 PDT 2026


================
@@ -743,8 +746,130 @@ void AMDGPUAsmPrinter::emitCommonFunctionComments(
   }
   OutStreamer->emitRawComment(" ScratchSize: " + getMCExprStr(ScratchSize),
                               false);
-  OutStreamer->emitRawComment(" MemoryBound: " + Twine(MFI->isMemoryBound()),
-                              false);
+  OutStreamer->emitRawComment(" MemoryBound: " + Twine(IsMemoryBound), false);
+}
+
+void AMDGPUAsmPrinter::emitDeferredComments() {
+  for (const auto &Info : DeferredComments) {
+    const Function &F = *Info.F;
+    const GCNSubtarget &STM = TM.getSubtarget<GCNSubtarget>(F);
+    MCSymbol *FnSym = TM.getSymbol(&F);
+    StringRef FuncName = FnSym->getName();
+    bool IsMemoryBound =
+        F.getFnAttribute("amdgpu-memory-bound").getValueAsBool();
+
+    MCSectionELF *CommentSection =
+        OutContext.getELFSection(".AMDGPU.csdata", ELF::SHT_PROGBITS, 0);
----------------
arsenm wrote:

Or switch to something more neutral like .text or .rodata 

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


More information about the llvm-commits mailing list