Skip to content

Commit b8e5307

Browse files
authored
update_mir_test_checks: keep comment embedded in MIR (#140016)
We often add inline comment in mir. It is useful to keep them.
1 parent a0a55df commit b8e5307

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

llvm/test/tools/UpdateTestChecks/update_mir_test_checks/Inputs/x86-dead-def.mir

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ body: |
1414
bb.1:
1515
dead %0:gr32(s32) = G_CONSTANT i32 0
1616
dead undef %1.sub_32bit:gr64(s32) = G_CONSTANT i32 1
17+
; Keep meaningful comment.
1718
undef %2.sub_32bit:gr64(s32) = G_CONSTANT i32 2
1819
...

llvm/test/tools/UpdateTestChecks/update_mir_test_checks/Inputs/x86-dead-def.mir.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ body: |
1818
; CHECK-NEXT: undef [[C2:%[0-9]+]].sub_32bit:gr64(s32) = G_CONSTANT i32 2
1919
dead %0:gr32(s32) = G_CONSTANT i32 0
2020
dead undef %1.sub_32bit:gr64(s32) = G_CONSTANT i32 1
21+
; Keep meaningful comment.
2122
undef %2.sub_32bit:gr64(s32) = G_CONSTANT i32 2
2223
...

llvm/utils/update_mir_test_checks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,9 @@ def mangle_vreg(opcode, current_names):
339339

340340

341341
def should_add_line_to_output(input_line, prefix_set):
342-
# Skip any check lines that we're handling as well as comments
342+
# Skip any check lines that we're handling as well as blank comment.
343343
m = common.CHECK_RE.match(input_line)
344-
if (m and m.group(1) in prefix_set) or re.search("^[ \t]*;", input_line):
344+
if (m and m.group(1) in prefix_set) or input_line.strip() == ";":
345345
return False
346346
return True
347347

0 commit comments

Comments
 (0)