[Mlir-commits] [mlir] [MLIR] When generating tests explicitly match only valid SSA var names (PR #67279)

Ivan R. Ivanov llvmlistbot at llvm.org
Sun Sep 24 19:45:28 PDT 2023


https://github.com/ivanradanov created https://github.com/llvm/llvm-project/pull/67279

Matching everything for variable names causes problems when there are
multiple variables of the same type in a function definition. The match
greedily assigned everything up to the second value definition to the
name of the first value.


>From f7751335f14681962a0b9e87c23e142eccdcd3a7 Mon Sep 17 00:00:00 2001
From: Ivan Radanov Ivanov <ivanov.i.aa at m.titech.ac.jp>
Date: Mon, 25 Sep 2023 11:35:40 +0900
Subject: [PATCH] [MLIR] When generating tests explicitly match only valid SSA
 var names

Matching everything for variable names causes problems when there are
multiple variables of the same type in a function definition. The match
greedily assigned everything up to the second value definition to the
name of the first value.
---
 mlir/utils/generate-test-checks.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/utils/generate-test-checks.py b/mlir/utils/generate-test-checks.py
index 8faa425beace1d7..e912be44cf95a1a 100755
--- a/mlir/utils/generate-test-checks.py
+++ b/mlir/utils/generate-test-checks.py
@@ -180,7 +180,7 @@ def process_line(line_chunks, variable_namer):
         else:
             # Otherwise, generate a new variable.
             variable = variable_namer.generate_name(ssa_name)
-            output_line += "%[[" + variable + ":.*]]"
+            output_line += "%[[" + variable + ":" + SSA_RE_STR + "]]"
 
         # Append the non named group.
         output_line += chunk[len(ssa_name) :]



More information about the Mlir-commits mailing list