Skip to content

Commit df6c26f

Browse files
committed
update_analyze_test_checks.py: fix --filter handling
In particular, after filtering the check lines can't necessarily use `-NEXT`, they may not be one directly after another.
1 parent 08ba81f commit df6c26f

File tree

5 files changed

+37
-3
lines changed

5 files changed

+37
-3
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2+
; RUN: opt < %s -passes='print<cost-model>' -mtriple=x86_64-pc-linux-gnu 2>&1 -disable-output -mattr=+sse2 | FileCheck %s --check-prefixes=SSE2
3+
4+
define void @replication_i64_stride2() nounwind {
5+
%vf2 = shufflevector <2 x i64> undef, <2 x i64> poison, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
6+
%vf4 = shufflevector <4 x i64> undef, <4 x i64> poison, <8 x i32> <i32 0, i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3>
7+
%vf8 = shufflevector <8 x i64> undef, <8 x i64> poison, <16 x i32> <i32 0, i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3, i32 4, i32 4, i32 5, i32 5, i32 6, i32 6, i32 7, i32 7>
8+
%vf16 = shufflevector <16 x i64> undef, <16 x i64> poison, <32 x i32> <i32 0, i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3, i32 4, i32 4, i32 5, i32 5, i32 6, i32 6, i32 7, i32 7, i32 8, i32 8, i32 9, i32 9, i32 10, i32 10, i32 11, i32 11, i32 12, i32 12, i32 13, i32 13, i32 14, i32 14, i32 15, i32 15>
9+
ret void
10+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2+
; RUN: opt < %s -passes='print<cost-model>' -mtriple=x86_64-pc-linux-gnu 2>&1 -disable-output -mattr=+sse2 | FileCheck %s --check-prefixes=SSE2
3+
4+
define void @replication_i64_stride2() nounwind {
5+
; SSE2-LABEL: 'replication_i64_stride2'
6+
; SSE2: Cost Model: Found an estimated cost of 18 for instruction: %vf4 = shufflevector <4 x i64> undef, <4 x i64> poison, <8 x i32> <i32 0, i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3>
7+
; SSE2: Cost Model: Found an estimated cost of 72 for instruction: %vf16 = shufflevector <16 x i64> undef, <16 x i64> poison, <32 x i32> <i32 0, i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3, i32 4, i32 4, i32 5, i32 5, i32 6, i32 6, i32 7, i32 7, i32 8, i32 8, i32 9, i32 9, i32 10, i32 10, i32 11, i32 11, i32 12, i32 12, i32 13, i32 13, i32 14, i32 14, i32 15, i32 15>
8+
;
9+
%vf2 = shufflevector <2 x i64> undef, <2 x i64> poison, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
10+
%vf4 = shufflevector <4 x i64> undef, <4 x i64> poison, <8 x i32> <i32 0, i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3>
11+
%vf8 = shufflevector <8 x i64> undef, <8 x i64> poison, <16 x i32> <i32 0, i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3, i32 4, i32 4, i32 5, i32 5, i32 6, i32 6, i32 7, i32 7>
12+
%vf16 = shufflevector <16 x i64> undef, <16 x i64> poison, <32 x i32> <i32 0, i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3, i32 4, i32 4, i32 5, i32 5, i32 6, i32 6, i32 7, i32 7, i32 8, i32 8, i32 9, i32 9, i32 10, i32 10, i32 11, i32 11, i32 12, i32 12, i32 13, i32 13, i32 14, i32 14, i32 15, i32 15>
13+
ret void
14+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# REQUIRES: x86-registered-target
2+
3+
## Check that --filter works properly.
4+
# RUN: cp -f %S/Inputs/x86-filter.ll %t.ll && %update_analyze_test_checks --filter="(vf4|vf16)" %t.ll
5+
# RUN: diff -u %t.ll %S/Inputs/x86-filter.ll.filter.expected
6+
7+
## Check that running the script again does not change the result:
8+
# RUN: %update_analyze_test_checks --filter="(vf4|vf16)" %t.ll
9+
# RUN: diff -u %t.ll %S/Inputs/x86-filter.ll.filter.expected

llvm/utils/UpdateTestChecks/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,12 +916,12 @@ def add_ir_checks(output_lines, comment_marker, prefix_list, func_dict,
916916
check_label_format, False, preserve_names, global_vars_seen_dict,
917917
is_filtered)
918918

919-
def add_analyze_checks(output_lines, comment_marker, prefix_list, func_dict, func_name):
919+
def add_analyze_checks(output_lines, comment_marker, prefix_list, func_dict, func_name, is_filtered):
920920
check_label_format = '{} %s-LABEL: \'%s%s\''.format(comment_marker)
921921
global_vars_seen_dict = {}
922922
add_checks(output_lines, comment_marker, prefix_list, func_dict, func_name,
923923
check_label_format, False, True, global_vars_seen_dict,
924-
is_filtered = False)
924+
is_filtered)
925925

926926
def build_global_values_dictionary(glob_val_dict, raw_tool_output, prefixes):
927927
for nameless_value in nameless_values:

llvm/utils/update_analyze_test_checks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ def main():
149149
continue
150150

151151
# Print out the various check lines here.
152-
common.add_analyze_checks(output_lines, ';', prefix_list, func_dict, func_name)
152+
common.add_analyze_checks(output_lines, ';', prefix_list, func_dict, func_name,
153+
is_filtered=builder.is_filtered())
153154
is_in_function_start = False
154155

155156
if is_in_function:

0 commit comments

Comments
 (0)