Skip to content
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: 5 additions & 6 deletions mlir/utils/generate-test-checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,9 @@ def generate_name(self, source_attribute_name):
return attribute_name

# Get the saved substitution name for the given attribute name. If no name
# has been generated for the given attribute yet, the source attribute name
# itself is returned.
# has been generated for the given attribute yet, None is returned.
def get_name(self, source_attribute_name):
return self.map[source_attribute_name] if source_attribute_name in self.map else '?'
return self.map.get(source_attribute_name)

# Return the number of SSA results in a line of type
# %0, %1, ... = ...
Expand Down Expand Up @@ -227,9 +226,9 @@ def process_attribute_references(line, attribute_namer):
components = ATTR_RE.split(line)
for component in components:
m = ATTR_RE.match(component)
if m:
output_line += '#[[' + attribute_namer.get_name(m.group(1)) + ']]'
output_line += component[len(m.group()):]
attribute_name = attribute_namer.get_name(m.group(1)) if m else None
if attribute_name:
output_line += f"#[[{attribute_name}]]{component[len(m.group()):]}"
else:
output_line += component
return output_line
Expand Down
Loading