diff --git a/mlir/lib/Transforms/DialectConversion.cpp b/mlir/lib/Transforms/DialectConversion.cpp --- a/mlir/lib/Transforms/DialectConversion.cpp +++ b/mlir/lib/Transforms/DialectConversion.cpp @@ -51,9 +51,12 @@ : Optional(); if (legalityInfo && legalityInfo->isRecursivelyLegal) continue; - for (auto ®ion : op.getRegions()) - computeConversionSet(region.getBlocks(), region.getLoc(), toConvert, - target); + for (auto ®ion : op.getRegions()) { + auto result = computeConversionSet(region.getBlocks(), region.getLoc(), + toConvert, target); + if (failed(result)) + return result; + } } // Recurse to children that haven't been visited.