================
@@ -5930,6 +5917,49 @@ void populateCIRToLLVMPasses(mlir::OpPassManager &pm, 
bool enableOpenMP) {
     pm.addPass(mlir::omp::createHostOpFilteringPass());
 }
 
+// Expand calls to the internal __cir_amdgpu_printf marker CIRGen emits for a
+// device-side printf into the real AMDGPU sequence.
+void expandAMDGPUDevicePrintf(llvm::Module &module) {
+  llvm::Function *marker = module.getFunction("__cir_amdgpu_printf");
+  if (!marker)
+    return;
+
+  // CIR records the requested lowering as a module flag.
+  bool isBuffered = false;
+  if (llvm::Metadata *md =
+          module.getModuleFlag(cir::CIRDialect::getAMDGPUPrintfKindAttrName()))
+    if (auto *mdStr = llvm::dyn_cast<llvm::MDString>(md))
----------------
steffenlarsen wrote:

You're absolutely right! It was not well tested, so it slipped under the radar. 
It now has a test and the right handling is implemented.

https://github.com/llvm/llvm-project/pull/226435
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to