[flang-commits] [flang] [flang] Emit `argNo` debug info only for `func` block args (PR #93921)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Fri May 31 04:19:46 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()))
----------------
tblah wrote:
We should probably also be checking this is a block argument to the entry block.
I think maybe `isDummyArgument` should be made available for use here https://github.com/llvm/llvm-project/blob/main/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp#L31
https://github.com/llvm/llvm-project/pull/93921
More information about the flang-commits
mailing list