Skip to content

Commit

Permalink
[mlir2FileCheck tool] handle multiple output arguments (#2946)
Browse files Browse the repository at this point in the history
Signed-off-by: Tung D. Le <[email protected]>
Co-authored-by: Alexandre Eichenberger <[email protected]>
  • Loading branch information
tungld and AlexandreEichenberger authored Sep 19, 2024
1 parent d03eff2 commit bf905d1
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions utils/mlir2FileCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,20 @@ def process_line(i, line):
new_line = process_name(new_line, def1_pat, "BLOCK_TILE_", ",", 1)
new_line = process_name(new_line, def2_pat, "BLOCK_IN_", " =", 1)
else:
definitions = def_qual_pat.findall(new_line)
def_qual_pat2 = re.compile(
r"((?:%(?:[a-zA-Z0-9][a-zA-Z0-9_\-]*)(?::\d+)?,?\s+)*)="
)
definitions = def_qual_pat2.findall(new_line)
for d in definitions:
(name, num) = d
x = use_name(name, num, " =")
y = record_name_def(name, num, "VAR_" + name, " =", 0, new_line)
new_line = new_line.replace(x, y)
arg_def_pat = re.compile(r"%([a-zA-Z0-9][a-zA-Z0-9_\-]*)(:\d+)?")
arg_defs = d.split(",")
for arg_def in arg_defs:
args = arg_def_pat.findall(arg_def)
for arg in args:
(name, num) = arg
x = use_name(name, num, "")
y = record_name_def(name, num, "VAR_" + name, "", 0, new_line)
new_line = new_line.replace(x, y)

# Process uses and map use.
uses = use_qual_pat.findall(new_line)
Expand Down

0 comments on commit bf905d1

Please sign in to comment.