diff --git a/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-filter.ll b/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-filter.ll new file mode 100644 index 0000000000000..24c5be28692d7 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-filter.ll @@ -0,0 +1,10 @@ +; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py +; RUN: opt < %s -passes='print' -mtriple=x86_64-pc-linux-gnu 2>&1 -disable-output -mattr=+sse2 | FileCheck %s --check-prefixes=SSE2 + +define void @replication_i64_stride2() nounwind { + %vf2 = shufflevector <2 x i64> undef, <2 x i64> poison, <4 x i32> + %vf4 = shufflevector <4 x i64> undef, <4 x i64> poison, <8 x i32> + %vf8 = shufflevector <8 x i64> undef, <8 x i64> poison, <16 x i32> + %vf16 = shufflevector <16 x i64> undef, <16 x i64> poison, <32 x i32> + ret void +} diff --git a/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-filter.ll.filter.expected b/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-filter.ll.filter.expected new file mode 100644 index 0000000000000..fd0d0a47bd870 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-filter.ll.filter.expected @@ -0,0 +1,14 @@ +; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py +; RUN: opt < %s -passes='print' -mtriple=x86_64-pc-linux-gnu 2>&1 -disable-output -mattr=+sse2 | FileCheck %s --check-prefixes=SSE2 + +define void @replication_i64_stride2() nounwind { +; SSE2-LABEL: 'replication_i64_stride2' +; SSE2: Cost Model: Found an estimated cost of 18 for instruction: %vf4 = shufflevector <4 x i64> undef, <4 x i64> poison, <8 x i32> +; SSE2: Cost Model: Found an estimated cost of 72 for instruction: %vf16 = shufflevector <16 x i64> undef, <16 x i64> poison, <32 x i32> +; + %vf2 = shufflevector <2 x i64> undef, <2 x i64> poison, <4 x i32> + %vf4 = shufflevector <4 x i64> undef, <4 x i64> poison, <8 x i32> + %vf8 = shufflevector <8 x i64> undef, <8 x i64> poison, <16 x i32> + %vf16 = shufflevector <16 x i64> undef, <16 x i64> poison, <32 x i32> + ret void +} diff --git a/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/filter.test b/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/filter.test new file mode 100644 index 0000000000000..0be97d5d9e75d --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/filter.test @@ -0,0 +1,9 @@ +# REQUIRES: x86-registered-target + +## Check that --filter works properly. +# RUN: cp -f %S/Inputs/x86-filter.ll %t.ll && %update_analyze_test_checks --filter="(vf4|vf16)" %t.ll +# RUN: diff -u %t.ll %S/Inputs/x86-filter.ll.filter.expected + +## Check that running the script again does not change the result: +# RUN: %update_analyze_test_checks --filter="(vf4|vf16)" %t.ll +# RUN: diff -u %t.ll %S/Inputs/x86-filter.ll.filter.expected diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index c073f25d384be..38a0fd12625f4 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -916,12 +916,12 @@ def add_ir_checks(output_lines, comment_marker, prefix_list, func_dict, check_label_format, False, preserve_names, global_vars_seen_dict, is_filtered) -def add_analyze_checks(output_lines, comment_marker, prefix_list, func_dict, func_name): +def add_analyze_checks(output_lines, comment_marker, prefix_list, func_dict, func_name, is_filtered): check_label_format = '{} %s-LABEL: \'%s%s\''.format(comment_marker) global_vars_seen_dict = {} add_checks(output_lines, comment_marker, prefix_list, func_dict, func_name, check_label_format, False, True, global_vars_seen_dict, - is_filtered = False) + is_filtered) def build_global_values_dictionary(glob_val_dict, raw_tool_output, prefixes): for nameless_value in nameless_values: diff --git a/llvm/utils/update_analyze_test_checks.py b/llvm/utils/update_analyze_test_checks.py index cfb063294364d..15708e52c133c 100755 --- a/llvm/utils/update_analyze_test_checks.py +++ b/llvm/utils/update_analyze_test_checks.py @@ -149,7 +149,8 @@ def main(): continue # Print out the various check lines here. - common.add_analyze_checks(output_lines, ';', prefix_list, func_dict, func_name) + common.add_analyze_checks(output_lines, ';', prefix_list, func_dict, func_name, + is_filtered=builder.is_filtered()) is_in_function_start = False if is_in_function: