[Mlir-commits] [mlir] [mlir][Transforms] Fix crash in `CFGToSCF` when conversion fails (PR #173590)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Mon Dec 29 01:35:57 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:
Not exactly, this is more of a hotfix. Generally, we shouldn't transform IR in an irreversible way if the transformation can later fail.
https://github.com/llvm/llvm-project/pull/173590
More information about the Mlir-commits
mailing list