diff --git a/mlir/lib/Tools/mlir-translate/MlirTranslateMain.cpp b/mlir/lib/Tools/mlir-translate/MlirTranslateMain.cpp --- a/mlir/lib/Tools/mlir-translate/MlirTranslateMain.cpp +++ b/mlir/lib/Tools/mlir-translate/MlirTranslateMain.cpp @@ -121,6 +121,8 @@ SourceMgrDiagnosticHandler sourceMgrHandler(*sourceMgr, &context); result = (*translationRequested)(sourceMgr, *stream, &context); } + if (failed(result)) + return result; if (i < translationsRequested.size() - 1) { // If there are further translations, create a new buffer with the