[Mlir-commits] [mlir] [mlir][gpu] Fix bug with gpu.printf global location (PR #142872)

River Riddle llvmlistbot at llvm.org
Wed Jun 4 16:20:05 PDT 2025


================
@@ -543,14 +543,20 @@ LogicalResult GPUPrintfOpToVPrintfLowering::matchAndRewrite(
   // the device code, not the host code
   auto moduleOp = gpuPrintfOp->getParentOfType<gpu::GPUModuleOp>();
 
+  // Convert the location to a valid global location of type FileLineColLoc if
+  // found else UnknownLoc. Remove any metadata from the location which is not
+  // valid for a global location.
----------------
River707 wrote:

```suggestion
  // found else UnknownLoc. Remove any debug info related metadata from the location which is not
  // valid for a global location.
```

Would be good to be a tad more descriptive on what is being removed here, helps add context to what it means to be a "valid global location". The key here is that debug info metadata inside of a function can't be used outside of that function.

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


More information about the Mlir-commits mailing list