[Mlir-commits] [mlir] [mlir][debug] Convert DbgIntrOp to DebugRecords directly. (PR #154926)

Abid Qadeer llvmlistbot at llvm.org
Tue Aug 26 04:01:26 PDT 2025


================
@@ -721,6 +727,29 @@ def LLVM_DbgValueOp : LLVM_DbgIntrOp<"dbg.value", "value",
     LLVM_DILocalVariableAttr:$varInfo,
     DefaultValuedAttr<LLVM_DIExpressionAttr, "{}">:$locationExpr
   );
+  let llvmBuilder = [{
+    // Debug intrinsics without debug locations are invalid.
+    if(!builder.getCurrentDebugLocation())
+      return success();
+    llvm::Function *parentFn = builder.GetInsertBlock()->getParent();
+    llvm::DILocalScope *scope;
+    if (auto scopeLoc =
+            opInst.getLoc()->findInstanceOf<FusedLocWith<LLVM::DIScopeAttr>>())
+      scope = llvm::cast<llvm::DILocalScope>(
+          moduleTranslation.translateDebugInfo(scopeLoc.getMetadata()));
+    else
+      scope = parentFn->getSubprogram();
+
+    llvm::Module *module = builder.GetInsertBlock()->getModule();
+    llvm::DIBuilder DB(*module);
----------------
abidh wrote:

Done.

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


More information about the Mlir-commits mailing list