================
@@ -269,10 +269,12 @@ void CIRGenFunction::LexicalScope::cleanup() {
     // Leverage and defers to RunCleanupsScope's dtor and scope handling.
     applyCleanup();
 
+    mlir::Block *currentBlock = builder.getBlock();
+
     // If we now have one after `applyCleanup`, hook it up properly.
     if (!cleanupBlock && localScope->getCleanupBlock(builder)) {
       cleanupBlock = localScope->getCleanupBlock(builder);
-      cir::BrOp::create(builder, insPt->back().getLoc(), cleanupBlock);
+      cir::BrOp::create(builder, currentBlock->back().getLoc(), cleanupBlock);
----------------
andykaylor wrote:

Are we hitting this code? I don't see a branch op in any of the tests in this 
PR, and I would hope there won't be any. We want the control flow to be 
structured at this point. If we're branching to a cleanup handler, that will 
need to be fixed.

https://github.com/llvm/llvm-project/pull/180276
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to