Skip to content

Commit 632bb0f

Browse files
committed
Revert "[mlir][Pass] Handle escaped pipline option values (#97667)"
This reverts commit 27bb2a3.
1 parent 99f3150 commit 632bb0f

File tree

3 files changed

+0
-35
lines changed

3 files changed

+0
-35
lines changed

mlir/include/mlir/Pass/PassOptions.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,6 @@ template <typename ParserT>
6060
static void printOptionValue(raw_ostream &os, const bool &value) {
6161
os << (value ? StringRef("true") : StringRef("false"));
6262
}
63-
template <typename ParserT>
64-
static void printOptionValue(raw_ostream &os, const std::string &str) {
65-
// Check if the string needs to be escaped before writing it to the ostream.
66-
const size_t spaceIndex = str.find_first_of(' ');
67-
const size_t escapeIndex =
68-
std::min({str.find_first_of('{'), str.find_first_of('\''),
69-
str.find_first_of('"')});
70-
const bool requiresEscape = spaceIndex < escapeIndex;
71-
if (requiresEscape)
72-
os << "{";
73-
os << str;
74-
if (requiresEscape)
75-
os << "}";
76-
}
7763
template <typename ParserT, typename DataT>
7864
static std::enable_if_t<has_stream_operator<DataT>::value>
7965
printOptionValue(raw_ostream &os, const DataT &value) {

mlir/lib/Pass/PassRegistry.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -257,20 +257,6 @@ parseNextArg(StringRef options) {
257257
auto extractArgAndUpdateOptions = [&](size_t argSize) {
258258
StringRef str = options.take_front(argSize).trim();
259259
options = options.drop_front(argSize).ltrim();
260-
// Handle escape sequences
261-
if (str.size() > 2) {
262-
const auto escapePairs = {std::make_pair('\'', '\''),
263-
std::make_pair('"', '"'),
264-
std::make_pair('{', '}')};
265-
for (const auto &escape : escapePairs) {
266-
if (str.front() == escape.first && str.back() == escape.second) {
267-
// Drop the escape characters and trim.
268-
str = str.drop_front().drop_back().trim();
269-
// Don't process additional escape sequences.
270-
break;
271-
}
272-
}
273-
}
274260
return str;
275261
};
276262
// Try to process the given punctuation, properly escaping any contained

mlir/test/Pass/pipeline-options-parsing.mlir

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
// RUN: mlir-opt %s -verify-each=false -pass-pipeline='builtin.module(func.func(test-options-pass{string-list=a list=1,2,3,4 string-list=b,c list=5 string-list=d string=nested_pipeline{arg1=10 arg2=" {} " arg3=true}}))' -dump-pass-pipeline 2>&1 | FileCheck --check-prefix=CHECK_1 %s
88
// RUN: mlir-opt %s -verify-each=false -test-options-pass-pipeline='list=1 string-list=a,b enum=one' -dump-pass-pipeline 2>&1 | FileCheck --check-prefix=CHECK_2 %s
99
// RUN: mlir-opt %s -verify-each=false -pass-pipeline='builtin.module(builtin.module(func.func(test-options-pass{list=3}), func.func(test-options-pass{enum=one list=1,2,3,4})))' -dump-pass-pipeline 2>&1 | FileCheck --check-prefix=CHECK_3 %s
10-
// RUN: mlir-opt %s -verify-each=false -pass-pipeline='builtin.module(builtin.module(func.func(test-options-pass{list=3}), func.func(test-options-pass{enum=one list=1,2,3,4 string="foobar"})))' -dump-pass-pipeline 2>&1 | FileCheck --check-prefix=CHECK_4 %s
11-
// RUN: mlir-opt %s -verify-each=false -pass-pipeline='builtin.module(builtin.module(func.func(test-options-pass{list=3}), func.func(test-options-pass{enum=one list=1,2,3,4 string="foo bar baz"})))' -dump-pass-pipeline 2>&1 | FileCheck --check-prefix=CHECK_5 %s
12-
// RUN: mlir-opt %s -verify-each=false -pass-pipeline='builtin.module(builtin.module(func.func(test-options-pass{list=3}), func.func(test-options-pass{enum=one list=1,2,3,4 string={foo bar baz}})))' -dump-pass-pipeline 2>&1 | FileCheck --check-prefix=CHECK_5 %s
13-
// RUN: mlir-opt %s -verify-each=false -pass-pipeline='builtin.module(builtin.module(func.func(test-options-pass{list=3}), func.func(test-options-pass{enum=one list=1,2,3,4 string=foo"bar"baz})))' -dump-pass-pipeline 2>&1 | FileCheck --check-prefix=CHECK_6 %s
1410

1511
// CHECK_ERROR_1: missing closing '}' while processing pass options
1612
// CHECK_ERROR_2: no such option test-option
@@ -21,6 +17,3 @@
2117
// CHECK_1: test-options-pass{enum=zero list=1,2,3,4,5 string=nested_pipeline{arg1=10 arg2=" {} " arg3=true} string-list=a,b,c,d}
2218
// CHECK_2: test-options-pass{enum=one list=1 string= string-list=a,b}
2319
// CHECK_3: builtin.module(builtin.module(func.func(test-options-pass{enum=zero list=3 string= }),func.func(test-options-pass{enum=one list=1,2,3,4 string= })))
24-
// CHECK_4: builtin.module(builtin.module(func.func(test-options-pass{enum=zero list=3 string= }),func.func(test-options-pass{enum=one list=1,2,3,4 string=foobar })))
25-
// CHECK_5: builtin.module(builtin.module(func.func(test-options-pass{enum=zero list=3 string= }),func.func(test-options-pass{enum=one list=1,2,3,4 string={foo bar baz} })))
26-
// CHECK_6: builtin.module(builtin.module(func.func(test-options-pass{enum=zero list=3 string= }),func.func(test-options-pass{enum=one list=1,2,3,4 string=foo"bar"baz })))

0 commit comments

Comments
 (0)