Skip to content

Commit 0e1ed98

Browse files
smeenailanza
authored andcommitted
[CIR][FlattenCFG] Fix rewrite API misuse (#1163)
We need to perform all erasures via the rewrite API instead of directly for the framework to work correctly. This was detected by a combination of `-DMLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS=ON` [1] and ASAN. [1] https://mlir.llvm.org/getting_started/Debugging/#detecting-invalid-api-usage
1 parent 15a5d58 commit 0e1ed98

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/CIR/Dialect/Transforms/FlattenCFG.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ class CIRTryOpFlattening : public mlir::OpRewritePattern<cir::TryOp> {
313313
if (!callOp.getCleanup().empty()) {
314314
mlir::Block *cleanupBlock = &callOp.getCleanup().getBlocks().back();
315315
auto cleanupYield = cast<cir::YieldOp>(cleanupBlock->getTerminator());
316-
cleanupYield->erase();
316+
rewriter.eraseOp(cleanupYield);
317317
rewriter.mergeBlocks(cleanupBlock, landingPadBlock);
318318
rewriter.setInsertionPointToEnd(landingPadBlock);
319319
}

0 commit comments

Comments
 (0)