Skip to content
Merged
Changes from 1 commit
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
13 changes: 10 additions & 3 deletions mlir/utils/generate-test-checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def get_num_ssa_results(input_line):


# Process a line of input that has been split at each SSA identifier '%'.
def process_line(line_chunks, variable_namer):
def process_line(line_chunks, variable_namer, strict=False):
output_line = ""

# Process the rest that contained an SSA value name.
Expand All @@ -180,7 +180,14 @@ def process_line(line_chunks, variable_namer):
else:
# Otherwise, generate a new variable.
variable = variable_namer.generate_name(ssa_name)
output_line += "%[[" + variable + ":.*]]"
if strict:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use a more descriptive name here? Something like strict_name_re, just to be a bit more clear.

# Use stricter regexp for the variable name, if requested.
# Greedy matching may cause issues with the generic '.*'
# regexp when the checks are split across several
# lines (e.g. for CHECK-SAME).
output_line += "%[[" + variable + ":" + SSA_RE_STR + "]]"
else:
output_line += "%[[" + variable + ":.*]]"

# Append the non named group.
output_line += chunk[len(ssa_name) :]
Expand Down Expand Up @@ -390,7 +397,7 @@ def main():
output_line += " " * len(ssa_split[0])

# Process the rest of the line.
output_line += process_line([argument], variable_namer)
output_line += process_line([argument], variable_namer, strict=True)

# Append the output line.
output_segments[-1].append(output_line)
Expand Down
Loading