diff --git a/mlir/lib/Transforms/CompositePass.cpp b/mlir/lib/Transforms/CompositePass.cpp index b388a28da6424..16e276e3f41b7 100644 --- a/mlir/lib/Transforms/CompositePass.cpp +++ b/mlir/lib/Transforms/CompositePass.cpp @@ -35,7 +35,9 @@ struct CompositeFixedPointPass final populateFunc(dynamicPM); llvm::raw_string_ostream os(pipelineStr); - dynamicPM.printAsTextualPipeline(os); + llvm::interleave( + dynamicPM, [&](mlir::Pass &pass) { pass.printAsTextualPipeline(os); }, + [&]() { os << ","; }); } LogicalResult initializeOptions( diff --git a/mlir/test/Transforms/composite-pass.mlir b/mlir/test/Transforms/composite-pass.mlir index 829470c2c9aa6..75587edd5b96d 100644 --- a/mlir/test/Transforms/composite-pass.mlir +++ b/mlir/test/Transforms/composite-pass.mlir @@ -1,6 +1,10 @@ -// RUN: mlir-opt %s --log-actions-to=- --test-composite-fixed-point-pass -split-input-file | FileCheck %s +// RUN: mlir-opt %s --log-actions-to=- --test-composite-fixed-point-pass -split-input-file --dump-pass-pipeline 2>&1 | FileCheck %s --check-prefixes=CHECK,PIPELINE // RUN: mlir-opt %s --log-actions-to=- --composite-fixed-point-pass='name=TestCompositePass pipeline=any(canonicalize,cse)' -split-input-file | FileCheck %s +// Ensure the composite pass correctly prints its options. +// PIPELINE: builtin.module(composite-fixed-point-pass{max-iterations=10 name=TestCompositePass +// PIPELINE-SAME: pipeline=canonicalize{ max-iterations=10 max-num-rewrites=-1 region-simplify=normal test-convergence=false top-down=true},cse}) + // CHECK-LABEL: running `TestCompositePass` // CHECK: running `Canonicalizer` // CHECK: running `CSE`