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

Mehdi Amini llvmlistbot at llvm.org
Sat Feb 28 11:22:45 PST 2026


================
@@ -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();
----------------
joker-eph wrote:

I tried to achieve it here: https://github.com/llvm/llvm-project/pull/183935 if this looks better @ftynse 

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


More information about the Mlir-commits mailing list