[Mlir-commits] [mlir] [mlir][Transforms] Fix crash in `CFGToSCF` when conversion fails (PR #173590)

NohHyeon Kwon llvmlistbot at llvm.org
Fri Dec 26 04:03:56 PST 2025


================
@@ -1156,8 +1156,10 @@ static FailureOr<SmallVector<Block *>> transformToStructuredCFBranches(
     FailureOr<Operation *> result = interface.createStructuredBranchRegionOp(
         opBuilder, regionEntry->getTerminator(),
         continuation->getArgumentTypes(), conditionalRegions);
-    if (failed(result))
+    if (failed(result)) {
+      regionEntry->getTerminator()->dropAllReferences();
----------------
swote-git wrote:

I missed that point about the invalid IR state.
I've updated the latest commit to splice the blocks back to the parent region.
Please let me know if this looks right.

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


More information about the Mlir-commits mailing list