diff --git a/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-filter-with-spaces.ll b/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-filter-with-spaces.ll new file mode 100644 index 0000000000000..ff8e748e800ca --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-filter-with-spaces.ll @@ -0,0 +1,9 @@ +; 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-with-spaces.ll.filter.expected b/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-filter-with-spaces.ll.filter.expected new file mode 100644 index 0000000000000..d40cedf7ef228 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-filter-with-spaces.ll.filter.expected @@ -0,0 +1,13 @@ +; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --filter "vf4 =" +; 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> +; + %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-with-spaces.test b/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/filter-with-spaces.test new file mode 100644 index 0000000000000..6761b280e180c --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/filter-with-spaces.test @@ -0,0 +1,13 @@ +# REQUIRES: x86-registered-target + +## Check that --filter works properly. +# RUN: cp -f %S/Inputs/x86-filter-with-spaces.ll %t.ll && %update_analyze_test_checks --filter="vf4 =" %t.ll +# RUN: diff -u %t.ll %S/Inputs/x86-filter-with-spaces.ll.filter.expected + +## Check that running the script again does not change the result: +# RUN: %update_analyze_test_checks --filter="vf4 =" %t.ll +# RUN: diff -u %t.ll %S/Inputs/x86-filter-with-spaces.ll.filter.expected + +## Check that running the script again, without arguments, does not change the result: +# RUN: %update_analyze_test_checks %t.ll +# RUN: diff -u %t.ll %S/Inputs/x86-filter-with-spaces.ll.filter.expected diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index 38a0fd12625f4..9745e60bc45ea 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -7,6 +7,7 @@ import re import subprocess import sys +import shlex ##### Common utilities for update_*test_checks.py @@ -1072,7 +1073,7 @@ def get_autogennote_suffix(parser, args): def check_for_command(line, parser, args, argv, argparse_callback): cmd_m = UTC_ARGS_CMD.match(line) if cmd_m: - for option in cmd_m.group('cmd').strip().split(' '): + for option in shlex.split(cmd_m.group('cmd').strip()): if option: argv.append(option) args = parser.parse_args(filter(lambda arg: arg not in args.tests, argv))