Skip to content

Commit bb613f7

Browse files
committed
Add metadata pointer regex substitution to MIR update script
Signed-off-by: Domenic <domenic.nutile@gmail.com>
1 parent e56b592 commit bb613f7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

llvm/utils/update_mir_test_checks.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565
flags=(re.M | re.S),
6666
)
6767

68+
META_PTR_RE = re.compile(r"\<0x[a-f0-9]+\>", re.IGNORECASE)
69+
6870

6971
class LLC:
7072
def __init__(self, bin):
@@ -247,6 +249,14 @@ def update_test_file(args, test, autogenerated_note):
247249
common.warn("No triple found: skipping file", test_file=test)
248250
return
249251

252+
# Replace metadata pointer values inserted by LLC with generic regex
253+
# capturing the pointer's format so that stale values don't break tests
254+
no_pointer_output = ""
255+
for line in raw_tool_output.splitlines():
256+
line = META_PTR_RE.sub("<0x{{[0-9a-f]+}}>", line)
257+
no_pointer_output += line + "\n"
258+
raw_tool_output = no_pointer_output
259+
250260
build_function_info_dictionary(
251261
test,
252262
raw_tool_output,

0 commit comments

Comments
 (0)