Skip to content

[mlir] Add support for broader range of input files in generate-test-checks.py #134327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion mlir/utils/generate-test-checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,13 @@ def process_attribute_references(line, attribute_namer):
# Pre-process a line of input to remove any character sequences that will be
# problematic with FileCheck.
def preprocess_line(line):
# Replace any `{{` with escaped replacements. `{{` corresponds to regex
# checks in FileCheck.
output_line = line.replace("{{", "{{\\{\\{}}")

# Replace any double brackets, '[[' with escaped replacements. '[['
# corresponds to variable names in FileCheck.
output_line = line.replace("[[", "{{\\[\\[}}")
output_line = output_line.replace("[[", "{{\\[\\[}}")

# Replace any single brackets that are followed by an SSA identifier, the
# identifier will be replace by a variable; Creating the same situation as
Expand Down Expand Up @@ -327,6 +331,11 @@ def main():
if not input_line:
continue

# When using `--starts_from_scope=0` to capture module lines, the file
# split needs to be skipped, otherwise a `CHECK: // -----` is inserted.
if input_line.startswith("// -----"):
continue

# Check if this is an attribute definition and process it
process_attribute_definition(input_line, attribute_namer, output)

Expand Down