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

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Thu Dec 25 23:09:29 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();
----------------
ftynse wrote:

This doesn't look right. It just removes some operands and keeps the IR in a weird state.

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


More information about the Mlir-commits mailing list