[Mlir-commits] [mlir] [MLIR][LLVM] Fix debug value/declare import in face of landing pads (PR #132871)
Christian Ulmann
llvmlistbot at llvm.org
Mon Mar 24 23:48:41 PDT 2025
================
@@ -2512,7 +2512,22 @@ ModuleImport::processDebugIntrinsic(llvm::DbgVariableIntrinsic *dbgIntr,
Block *dominatedBlock = (*dominatedBlocks.begin())->getBlock();
builder.setInsertionPoint(dominatedBlock->getTerminator());
} else {
- builder.setInsertionPointAfterValue(*argOperand);
+ Value insertPt = *argOperand;
+ if (!op) {
+ // The value might be coming from a phi value and is now a block argument,
+ // which means the insertion point is set to the start of the block. If
+ // this block is a target destination of an invoke, the insertion point
+ // must happen after the landing pad operation.
+ auto blockArg = llvm::cast<BlockArgument>(*argOperand);
+ mlir::Block *insertionBlock = blockArg.getOwner();
----------------
Dinistro wrote:
I think that you can just use `argOperand->getParentBlock()`, no?
https://github.com/llvm/llvm-project/pull/132871
More information about the Mlir-commits
mailing list