[flang-commits] [flang] [flang] Emit `argNo` debug info only for `func` block args (PR #93921)

Kareem Ergawy via flang-commits flang-commits at lists.llvm.org
Sun Jun 2 03:26:25 PDT 2024


================
@@ -94,10 +94,10 @@ void AddDebugInfoPass::handleDeclareOp(fir::cg::XDeclareOp declOp,
   // DeclareOp is generated. In that case, DeclareOp may point to an
   // intermediate op and not to BlockArgument. We need to find those cases and
   // walk the chain to get to the actual argument.
-
   unsigned argNo = 0;
-  if (auto Arg = llvm::dyn_cast<mlir::BlockArgument>(declOp.getMemref()))
-    argNo = Arg.getArgNumber() + 1;
+  if (mlir::isa<mlir::func::FuncOp>(declOp->getParentOp()))
+    if (auto arg = llvm::dyn_cast<mlir::BlockArgument>(declOp.getMemref()))
----------------
ergawy wrote:

Thanks for the suggestion, moved `isDummyArgument` to a shared util file and reused it.

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


More information about the flang-commits mailing list