[Mlir-commits] [mlir] 26167ca - Print the `// ----` separator between modules when using -split-input-file with mlir-opt

Mehdi Amini llvmlistbot at llvm.org
Thu Jan 20 21:16:21 PST 2022


Author: Mehdi Amini
Date: 2022-01-21T05:16:02Z
New Revision: 26167cae45154d326aba88c8e8ca72e2bc42ea30

URL: https://github.com/llvm/llvm-project/commit/26167cae45154d326aba88c8e8ca72e2bc42ea30
DIFF: https://github.com/llvm/llvm-project/commit/26167cae45154d326aba88c8e8ca72e2bc42ea30.diff

LOG: Print the `// ----` separator between modules when using -split-input-file with mlir-opt

This allows to pipe sequences of `mlir-opt -split-input-file | mlir-opt -split-input-file`.

Depends On D117750

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D117756

Added: 
    

Modified: 
    mlir/lib/Support/MlirOptMain.cpp
    mlir/test/Dialect/OpenACC/ops.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Support/MlirOptMain.cpp b/mlir/lib/Support/MlirOptMain.cpp
index 5c3f7a773240..af4681f50ccb 100644
--- a/mlir/lib/Support/MlirOptMain.cpp
+++ b/mlir/lib/Support/MlirOptMain.cpp
@@ -158,10 +158,12 @@ LogicalResult mlir::MlirOptMain(raw_ostream &outputStream,
     return splitAndProcessBuffer(
         std::move(buffer),
         [&](std::unique_ptr<MemoryBuffer> chunkBuffer, raw_ostream &os) {
-          return processBuffer(os, std::move(chunkBuffer), verifyDiagnostics,
-                               verifyPasses, allowUnregisteredDialects,
-                               preloadDialectsInContext, passManagerSetupFn,
-                               registry, threadPool);
+          LogicalResult result = processBuffer(
+              os, std::move(chunkBuffer), verifyDiagnostics, verifyPasses,
+              allowUnregisteredDialects, preloadDialectsInContext,
+              passManagerSetupFn, registry, threadPool);
+          os << "// -----\n";
+          return result;
         },
         outputStream);
 

diff  --git a/mlir/test/Dialect/OpenACC/ops.mlir b/mlir/test/Dialect/OpenACC/ops.mlir
index 9ced56acfe74..05e8026b554c 100644
--- a/mlir/test/Dialect/OpenACC/ops.mlir
+++ b/mlir/test/Dialect/OpenACC/ops.mlir
@@ -1,8 +1,8 @@
 // RUN: mlir-opt -split-input-file %s | FileCheck %s
 // Verify the printed output can be parsed.
-// RUN: mlir-opt -split-input-file %s | mlir-opt -allow-unregistered-dialect  | FileCheck %s
+// RUN: mlir-opt -split-input-file %s | mlir-opt  -split-input-file  | FileCheck %s
 // Verify the generic form can be parsed.
-// RUN: mlir-opt -split-input-file -mlir-print-op-generic %s | mlir-opt -allow-unregistered-dialect | FileCheck %s
+// RUN: mlir-opt -split-input-file -mlir-print-op-generic %s | mlir-opt -split-input-file | FileCheck %s
 
 func @compute1(%A: memref<10x10xf32>, %B: memref<10x10xf32>, %C: memref<10x10xf32>) -> memref<10x10xf32> {
   %c0 = arith.constant 0 : index


        


More information about the Mlir-commits mailing list