[PATCH] D158497: [UTC] Keep function args parenthesis on label line (bumps version to 3)
Jannik Silvanus via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 29 07:40:34 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG998c32391013: [UTC] Keep function args parenthesis on label line (bumps version to 3) (authored by jsilvanus).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158497/new/
https://reviews.llvm.org/D158497
Files:
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/named_function_arguments_split.ll.expected
llvm/test/tools/UpdateTestChecks/update_test_checks/named_function_arguments_split.test
llvm/utils/UpdateTestChecks/common.py
Index: llvm/utils/UpdateTestChecks/common.py
===================================================================
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -24,8 +24,10 @@
1: Initial version, used by tests that don't specify --version explicitly.
2: --function-signature is now enabled by default and also checks return
type/attributes.
+3: Opening parenthesis of function args is kept on the first LABEL line
+ in case arguments are split to a separate SAME line.
"""
-DEFAULT_VERSION = 2
+DEFAULT_VERSION = 3
class Regex(object):
@@ -1277,13 +1279,27 @@
)[0]
func_name_separator = func_dict[checkprefix][func_name].func_name_separator
if "[[" in args_and_sig:
+ # Captures in label lines are not supported, thus split into a -LABEL
+ # and a separate -SAME line that contains the arguments with captures.
+ args_and_sig_prefix = ""
+ if version >= 3 and args_and_sig.startswith("("):
+ # Ensure the "(" separating function name and arguments is in the
+ # label line. This is required in case of function names that are
+ # prefixes of each other. Otherwise, the label line for "foo" might
+ # incorrectly match on "foo.specialized".
+ args_and_sig_prefix = args_and_sig[0]
+ args_and_sig = args_and_sig[1:]
+
+ # Removing args_and_sig from the label match line requires
+ # func_name_separator to be empty. Otherwise, the match will not work.
+ assert func_name_separator == ""
output_lines.append(
check_label_format
% (
checkprefix,
funcdef_attrs_and_ret,
func_name,
- "",
+ args_and_sig_prefix,
func_name_separator,
)
)
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/named_function_arguments_split.test
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/named_function_arguments_split.test
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/named_function_arguments_split.test
@@ -1,7 +1,7 @@
# REQUIRES: x86-registered-target
## Basic test checking that update_test_checks.py works correctly
-# RUN: cp -f %S/Inputs/named_function_arguments_split.ll %t.ll && %update_test_checks %t.ll --version=2
+# RUN: cp -f %S/Inputs/named_function_arguments_split.ll %t.ll && %update_test_checks %t.ll --version=3
# RUN: diff -u %t.ll %S/Inputs/named_function_arguments_split.ll.expected
## Check that running the script again does not change the result:
-# RUN: %update_test_checks %t.ll --version=2
+# RUN: %update_test_checks %t.ll --version=3
# RUN: diff -u %t.ll %S/Inputs/named_function_arguments_split.ll.expected
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/named_function_arguments_split.ll.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/named_function_arguments_split.ll.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/named_function_arguments_split.ll.expected
@@ -1,14 +1,13 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
; Check that we split named function arguments correctly into a separate CHECK line,
; ensuring the opening parenthesis is on the label name, avoiding incorrect label
; matches if function names are not prefix free.
-; Note: This is a precommitted test, the current result is incorrect.
;
; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
;
define i32 @"foo"(i32 %named) {
-; CHECK-LABEL: define i32 @foo
-; CHECK-SAME: (i32 [[NAMED:%.*]]) {
+; CHECK-LABEL: define i32 @foo(
+; CHECK-SAME: i32 [[NAMED:%.*]]) {
; CHECK-NEXT: entry:
; CHECK-NEXT: ret i32 [[NAMED]]
;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158497.554331.patch
Type: text/x-patch
Size: 4260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230829/78fe778b/attachment.bin>
More information about the llvm-commits
mailing list