[llvm] 7128e64 - [UpdateTestChecks] include { in function signature check line

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 14:45:13 PDT 2020


Author: sstefan1
Date: 2020-08-28T23:44:03+02:00
New Revision: 7128e647063dd858901aa7a5d90be8744c673866

URL: https://github.com/llvm/llvm-project/commit/7128e647063dd858901aa7a5d90be8744c673866
DIFF: https://github.com/llvm/llvm-project/commit/7128e647063dd858901aa7a5d90be8744c673866.diff

LOG: [UpdateTestChecks] include { in function signature check line

After D85099, if we have attribute group in the function signature that hasn't
been seen before, and later a callsite with the same attribute group, filecheck will evaluate
the first attribute group to for example '#0 {'. We now include { in the args_and_sig group to avoid this.

Differential Revision: https://reviews.llvm.org/D86769

Added: 
    

Modified: 
    clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
    llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/argument_name_reuse.ll.expected
    llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic.ll.funcsig.expected
    llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected
    llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected
    llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/on_the_fly_arg_change.ll.expected
    llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/on_the_fly_arg_change.ll.initially_disabled.expected
    llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected
    llvm/utils/UpdateTestChecks/common.py

Removed: 
    


################################################################################
diff  --git a/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected b/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
index 313bd5bcef7c..2069f7e185bb 100644
--- a/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
+++ b/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
@@ -3,7 +3,7 @@
 // RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
 
 // CHECK-LABEL: define {{[^@]+}}@test
-// CHECK-SAME: (i64 [[A:%.*]], i32 [[B:%.*]]) [[ATTR0:#.*]]
+// CHECK-SAME: (i64 [[A:%.*]], i32 [[B:%.*]]) [[ATTR0:#.*]] {
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    [[A_ADDR:%.*]] = alloca i64, align 8
 // CHECK-NEXT:    [[B_ADDR:%.*]] = alloca i32, align 4
@@ -21,7 +21,7 @@ long test(long a, int b) {
 
 // A function with a mangled name
 // CHECK-LABEL: define {{[^@]+}}@_Z4testlii
-// CHECK-SAME: (i64 [[A:%.*]], i32 [[B:%.*]], i32 [[C:%.*]]) [[ATTR0]]
+// CHECK-SAME: (i64 [[A:%.*]], i32 [[B:%.*]], i32 [[C:%.*]]) [[ATTR0]] {
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    [[A_ADDR:%.*]] = alloca i64, align 8
 // CHECK-NEXT:    [[B_ADDR:%.*]] = alloca i32, align 4

diff  --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/argument_name_reuse.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/argument_name_reuse.ll.expected
index 461a8b6a5bf6..0e6f08020703 100644
--- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/argument_name_reuse.ll.expected
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/argument_name_reuse.ll.expected
@@ -3,7 +3,7 @@
 
 define i32 @reuse_arg_names(i32 %X, i32 %Y) {
 ; CHECK-LABEL: define {{[^@]+}}@reuse_arg_names
-; CHECK-SAME: (i32 [[X:%.*]], i32 [[Y:%.*]])
+; CHECK-SAME: (i32 [[X:%.*]], i32 [[Y:%.*]]) {
 ; CHECK-NEXT:    [[Z:%.*]] = sub i32 [[X]], [[Y]]
 ; CHECK-NEXT:    [[Q:%.*]] = add i32 [[Z]], [[Y]]
 ; CHECK-NEXT:    ret i32 [[Q]]

diff  --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic.ll.funcsig.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic.ll.funcsig.expected
index c30d105b60ae..03405ca57c2b 100644
--- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic.ll.funcsig.expected
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic.ll.funcsig.expected
@@ -4,7 +4,7 @@
 
 define i32 @common_sub_operand(i32 %X, i32 %Y) {
 ; CHECK-LABEL: define {{[^@]+}}@common_sub_operand
-; CHECK-SAME: (i32 [[X:%.*]], i32 [[Y:%.*]])
+; CHECK-SAME: (i32 [[X:%.*]], i32 [[Y:%.*]]) {
 ; CHECK-NEXT:    ret i32 [[X]]
 ;
   %Z = sub i32 %X, %Y
@@ -14,7 +14,7 @@ define i32 @common_sub_operand(i32 %X, i32 %Y) {
 
 define i32 @negated_operand(i32 %x) {
 ; CHECK-LABEL: define {{[^@]+}}@negated_operand
-; CHECK-SAME: (i32 [[X:%.*]])
+; CHECK-SAME: (i32 [[X:%.*]]) {
 ; CHECK-NEXT:    ret i32 0
 ;
   %negx = sub i32 0, %x
@@ -24,7 +24,7 @@ define i32 @negated_operand(i32 %x) {
 
 define <2 x i32> @negated_operand_commute_vec(<2 x i32> %x) {
 ; CHECK-LABEL: define {{[^@]+}}@negated_operand_commute_vec
-; CHECK-SAME: (<2 x i32> [[X:%.*]])
+; CHECK-SAME: (<2 x i32> [[X:%.*]]) {
 ; CHECK-NEXT:    ret <2 x i32> zeroinitializer
 ;
   %negx = sub <2 x i32> zeroinitializer, %x
@@ -34,7 +34,7 @@ define <2 x i32> @negated_operand_commute_vec(<2 x i32> %x) {
 
 define i8 @knownnegation(i8 %x, i8 %y) {
 ; CHECK-LABEL: define {{[^@]+}}@knownnegation
-; CHECK-SAME: (i8 [[X:%.*]], i8 [[Y:%.*]])
+; CHECK-SAME: (i8 [[X:%.*]], i8 [[Y:%.*]]) {
 ; CHECK-NEXT:    ret i8 0
 ;
   %xy = sub i8 %x, %y
@@ -45,7 +45,7 @@ define i8 @knownnegation(i8 %x, i8 %y) {
 
 define <2 x i8> @knownnegation_commute_vec(<2 x i8> %x, <2 x i8> %y) {
 ; CHECK-LABEL: define {{[^@]+}}@knownnegation_commute_vec
-; CHECK-SAME: (<2 x i8> [[X:%.*]], <2 x i8> [[Y:%.*]])
+; CHECK-SAME: (<2 x i8> [[X:%.*]], <2 x i8> [[Y:%.*]]) {
 ; CHECK-NEXT:    ret <2 x i8> zeroinitializer
 ;
   %xy = sub <2 x i8> %x, %y
@@ -56,7 +56,7 @@ define <2 x i8> @knownnegation_commute_vec(<2 x i8> %x, <2 x i8> %y) {
 
 define i32 @nameless_value(i32 %X) {
 ; CHECK-LABEL: define {{[^@]+}}@nameless_value
-; CHECK-SAME: (i32 [[X:%.*]])
+; CHECK-SAME: (i32 [[X:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = sub i32 42, [[X]]
 ; CHECK-NEXT:    ret i32 [[TMP1]]
 ;

diff  --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected
index 6fa31342e9a2..e98e62f62b0a 100644
--- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected
@@ -10,14 +10,14 @@
 define i32* @foo(%struct.ST* %s) nounwind uwtable readnone optsize ssp {
 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind optsize readnone ssp uwtable willreturn
 ; IS__TUNIT____-LABEL: define {{[^@]+}}@foo
-; IS__TUNIT____-SAME: (%struct.ST* nofree readnone [[S:%.*]]) [[ATTR0:#.*]]
+; IS__TUNIT____-SAME: (%struct.ST* nofree readnone [[S:%.*]]) [[ATTR0:#.*]] {
 ; IS__TUNIT____-NEXT:  entry:
 ; IS__TUNIT____-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds [[STRUCT_ST:%.*]], %struct.ST* [[S]], i64 1, i32 2, i32 1, i64 5, i64 13
 ; IS__TUNIT____-NEXT:    ret i32* [[ARRAYIDX]]
 ;
 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind optsize readnone ssp uwtable willreturn
 ; IS__CGSCC____-LABEL: define {{[^@]+}}@foo
-; IS__CGSCC____-SAME: (%struct.ST* nofree readnone [[S:%.*]]) [[ATTR0:#.*]]
+; IS__CGSCC____-SAME: (%struct.ST* nofree readnone [[S:%.*]]) [[ATTR0:#.*]] {
 ; IS__CGSCC____-NEXT:  entry:
 ; IS__CGSCC____-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds [[STRUCT_ST:%.*]], %struct.ST* [[S]], i64 1, i32 2, i32 1, i64 5, i64 13
 ; IS__CGSCC____-NEXT:    ret i32* [[ARRAYIDX]]

diff  --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected
index e749f3152a65..ea9d3f44d9ac 100644
--- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected
@@ -9,7 +9,7 @@
 
 define i32* @foo(%struct.ST* %s) nounwind uwtable readnone optsize ssp {
 ; CHECK-LABEL: define {{[^@]+}}@foo
-; CHECK-SAME: (%struct.ST* nofree readnone [[S:%.*]]) [[ATTR0:#.*]]
+; CHECK-SAME: (%struct.ST* nofree readnone [[S:%.*]]) [[ATTR0:#.*]] {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds [[STRUCT_ST:%.*]], %struct.ST* [[S]], i64 1, i32 2, i32 1, i64 5, i64 13
 ; CHECK-NEXT:    ret i32* [[ARRAYIDX]]

diff  --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/on_the_fly_arg_change.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/on_the_fly_arg_change.ll.expected
index b76f62c9cb13..5624ad3adaa1 100644
--- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/on_the_fly_arg_change.ll.expected
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/on_the_fly_arg_change.ll.expected
@@ -4,7 +4,7 @@
 declare void @foo()
 
 define void @check_lines_1() {
-; CHECK-LABEL: define {{[^@]+}}@check_lines_1()
+; CHECK-LABEL: define {{[^@]+}}@check_lines_1() {
 ; CHECK-NEXT:    ret void
 ;
   ret void
@@ -21,14 +21,14 @@ define void @no_check_lines() {
 ; UTC_ARGS: --enable
 
 define void @check_lines_2() {
-; CHECK-LABEL: define {{[^@]+}}@check_lines_2()
+; CHECK-LABEL: define {{[^@]+}}@check_lines_2() {
 ; CHECK-NEXT:    ret void
 ;
   ret void
 }
 
 define void @scrub() {
-; CHECK-LABEL: define {{[^@]+}}@scrub()
+; CHECK-LABEL: define {{[^@]+}}@scrub() {
 ; CHECK-NEXT:    call void @foo()
 ; CHECK-NEXT:    ret void
 ;
@@ -38,7 +38,7 @@ define void @scrub() {
 
 define i32 @signature(i32 %arg) {
 ; CHECK-LABEL: define {{[^@]+}}@signature
-; CHECK-SAME: (i32 [[ARG:%.*]])
+; CHECK-SAME: (i32 [[ARG:%.*]]) {
 ; CHECK-NEXT:    ret i32 [[ARG]]
 ;
   ret i32 %arg

diff  --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/on_the_fly_arg_change.ll.initially_disabled.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/on_the_fly_arg_change.ll.initially_disabled.expected
index 994209d46ddb..59ada459daca 100644
--- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/on_the_fly_arg_change.ll.initially_disabled.expected
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/on_the_fly_arg_change.ll.initially_disabled.expected
@@ -18,14 +18,14 @@ define void @no_check_lines() {
 ; UTC_ARGS: --enable
 
 define void @check_lines_2() {
-; CHECK-LABEL: define {{[^@]+}}@check_lines_2()
+; CHECK-LABEL: define {{[^@]+}}@check_lines_2() {
 ; CHECK-NEXT:    ret void
 ;
   ret void
 }
 
 define void @scrub() {
-; CHECK-LABEL: define {{[^@]+}}@scrub()
+; CHECK-LABEL: define {{[^@]+}}@scrub() {
 ; CHECK-NEXT:    call void @foo()
 ; CHECK-NEXT:    ret void
 ;
@@ -35,7 +35,7 @@ define void @scrub() {
 
 define i32 @signature(i32 %arg) {
 ; CHECK-LABEL: define {{[^@]+}}@signature
-; CHECK-SAME: (i32 [[ARG:%.*]])
+; CHECK-SAME: (i32 [[ARG:%.*]]) {
 ; CHECK-NEXT:    ret i32 [[ARG]]
 ;
   ret i32 %arg

diff  --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected
index 3d4e56d2ad1f..5a7d734cfab1 100644
--- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected
@@ -10,7 +10,7 @@ target triple = "x86_64-unknown-linux-gnu"
 ; Function Attrs: nounwind uwtable
 define dso_local void @foo(i32* %A) #0 !dbg !7 {
 ; CHECK-LABEL: define {{[^@]+}}@foo
-; CHECK-SAME: (i32* [[A:%.*]]) [[ATTR0:#.*]] [[DBG7:!dbg !.*]]
+; CHECK-SAME: (i32* [[A:%.*]]) [[ATTR0:#.*]] [[DBG7:!dbg !.*]] {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[A_ADDR:%.*]] = alloca i32*, align 8
 ; CHECK-NEXT:    [[I:%.*]] = alloca i32, align 4
@@ -99,7 +99,7 @@ declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #2
 ; Function Attrs: nounwind uwtable
 define dso_local void @bar(i32* %A) #0 !dbg !39 {
 ; CHECK-LABEL: define {{[^@]+}}@bar
-; CHECK-SAME: (i32* [[A:%.*]]) [[ATTR0]] [[DBG39:!dbg !.*]]
+; CHECK-SAME: (i32* [[A:%.*]]) [[ATTR0]] [[DBG39:!dbg !.*]] {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[A_ADDR:%.*]] = alloca i32*, align 8
 ; CHECK-NEXT:    [[I:%.*]] = alloca i32, align 4

diff  --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py
index 6adbebcb1774..23c4c1d1fc0c 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -146,7 +146,7 @@ def invoke_tool(exe, cmd_args, ir):
 
 OPT_FUNCTION_RE = re.compile(
     r'^(\s*;\s*Function\sAttrs:\s(?P<attrs>[\w\s]+?))?\s*define\s+(?:internal\s+)?[^@]*@(?P<func>[\w.-]+?)\s*'
-    r'(?P<args_and_sig>\((\)|(.*?[\w.-]+?)\))[^{]*)\{\n(?P<body>.*?)^\}$',
+    r'(?P<args_and_sig>\((\)|(.*?[\w.-]+?)\))[^{]*\{)\n(?P<body>.*?)^\}$',
     flags=(re.M | re.S))
 
 ANALYZE_FUNCTION_RE = re.compile(


        


More information about the llvm-commits mailing list