diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/argument_name_reuse.ll b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/argument_name_reuse.ll --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/argument_name_reuse.ll +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/argument_name_reuse.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -S | FileCheck %s define i32 @reuse_arg_names(i32 %X, i32 %Y) { diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic.ll.expected --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic.ll.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic.ll.expected @@ -1,10 +1,11 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature ; Example input for update_test_checks (taken from test/Transforms/InstSimplify/add.ll) ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s define i32 @common_sub_operand(i32 %X, i32 %Y) { -; CHECK-LABEL: @common_sub_operand( -; CHECK-NEXT: ret i32 [[X:%.*]] +; CHECK-LABEL: define {{[^@]+}}@common_sub_operand +; CHECK-SAME: (i32 [[X:%.*]], i32 [[Y:%.*]]) { +; CHECK-NEXT: ret i32 [[X]] ; %Z = sub i32 %X, %Y %Q = add i32 %Z, %Y @@ -12,7 +13,8 @@ } define i32 @negated_operand(i32 %x) { -; CHECK-LABEL: @negated_operand( +; CHECK-LABEL: define {{[^@]+}}@negated_operand +; CHECK-SAME: (i32 [[X:%.*]]) { ; CHECK-NEXT: ret i32 0 ; %negx = sub i32 0, %x @@ -21,7 +23,8 @@ } define <2 x i32> @negated_operand_commute_vec(<2 x i32> %x) { -; CHECK-LABEL: @negated_operand_commute_vec( +; CHECK-LABEL: define {{[^@]+}}@negated_operand_commute_vec +; CHECK-SAME: (<2 x i32> [[X:%.*]]) { ; CHECK-NEXT: ret <2 x i32> zeroinitializer ; %negx = sub <2 x i32> zeroinitializer, %x @@ -30,7 +33,8 @@ } define i8 @knownnegation(i8 %x, i8 %y) { -; CHECK-LABEL: @knownnegation( +; CHECK-LABEL: define {{[^@]+}}@knownnegation +; CHECK-SAME: (i8 [[X:%.*]], i8 [[Y:%.*]]) { ; CHECK-NEXT: ret i8 0 ; %xy = sub i8 %x, %y @@ -40,7 +44,8 @@ } define <2 x i8> @knownnegation_commute_vec(<2 x i8> %x, <2 x i8> %y) { -; CHECK-LABEL: @knownnegation_commute_vec( +; CHECK-LABEL: define {{[^@]+}}@knownnegation_commute_vec +; CHECK-SAME: (<2 x i8> [[X:%.*]], <2 x i8> [[Y:%.*]]) { ; CHECK-NEXT: ret <2 x i8> zeroinitializer ; %xy = sub <2 x i8> %x, %y @@ -50,8 +55,9 @@ } define i32 @nameless_value(i32 %X) { -; CHECK-LABEL: @nameless_value( -; CHECK-NEXT: [[TMP1:%.*]] = sub i32 42, [[X:%.*]] +; CHECK-LABEL: define {{[^@]+}}@nameless_value +; CHECK-SAME: (i32 [[X:%.*]]) { +; CHECK-NEXT: [[TMP1:%.*]] = sub i32 42, [[X]] ; CHECK-NEXT: ret i32 [[TMP1]] ; %1 = sub i32 42, %X 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 deleted file mode 100644 --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/basic.ll.funcsig.expected +++ /dev/null @@ -1,65 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature -; Example input for update_test_checks (taken from test/Transforms/InstSimplify/add.ll) -; RUN: opt < %s -passes=instsimplify -S | FileCheck %s - -define i32 @common_sub_operand(i32 %X, i32 %Y) { -; CHECK-LABEL: define {{[^@]+}}@common_sub_operand -; CHECK-SAME: (i32 [[X:%.*]], i32 [[Y:%.*]]) { -; CHECK-NEXT: ret i32 [[X]] -; - %Z = sub i32 %X, %Y - %Q = add i32 %Z, %Y - ret i32 %Q -} - -define i32 @negated_operand(i32 %x) { -; CHECK-LABEL: define {{[^@]+}}@negated_operand -; CHECK-SAME: (i32 [[X:%.*]]) { -; CHECK-NEXT: ret i32 0 -; - %negx = sub i32 0, %x - %r = add i32 %negx, %x - ret i32 %r -} - -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-NEXT: ret <2 x i32> zeroinitializer -; - %negx = sub <2 x i32> zeroinitializer, %x - %r = add <2 x i32> %x, %negx - ret <2 x i32> %r -} - -define i8 @knownnegation(i8 %x, i8 %y) { -; CHECK-LABEL: define {{[^@]+}}@knownnegation -; CHECK-SAME: (i8 [[X:%.*]], i8 [[Y:%.*]]) { -; CHECK-NEXT: ret i8 0 -; - %xy = sub i8 %x, %y - %yx = sub i8 %y, %x - %r = add i8 %xy, %yx - ret i8 %r -} - -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-NEXT: ret <2 x i8> zeroinitializer -; - %xy = sub <2 x i8> %x, %y - %yx = sub <2 x i8> %y, %x - %r = add <2 x i8> %yx, %xy - ret <2 x i8> %r -} - -define i32 @nameless_value(i32 %X) { -; CHECK-LABEL: define {{[^@]+}}@nameless_value -; CHECK-SAME: (i32 [[X:%.*]]) { -; CHECK-NEXT: [[TMP1:%.*]] = sub i32 42, [[X]] -; CHECK-NEXT: ret i32 [[TMP1]] -; - %1 = sub i32 42, %X - ret i32 %1 -} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -S < %s | FileCheck %s --check-prefixes=CHECK,IS__TUNIT____ ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -S < %s | FileCheck %s --check-prefixes=CHECK,IS__CGSCC____ 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 --- 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 @@ -1,4 +1,4 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes --function-signature ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -S < %s | FileCheck %s --check-prefixes=CHECK,IS__TUNIT____ ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -S < %s | FileCheck %s --check-prefixes=CHECK,IS__CGSCC____ diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/custom-tool.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/custom-tool.ll.expected --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/custom-tool.ll.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/custom-tool.ll.expected @@ -1,9 +1,10 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --tool llvm-extract +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --tool llvm-extract --function-signature ; RUN: llvm-extract -S --func=foo %s | FileCheck --check-prefixes=CHECK %s define i32 @foo(i32 %x) { -; CHECK-LABEL: @foo( -; CHECK-NEXT: [[Y:%.*]] = add i32 [[X:%.*]], 1 +; CHECK-LABEL: define {{[^@]+}}@foo +; CHECK-SAME: (i32 [[X:%.*]]) { +; CHECK-NEXT: [[Y:%.*]] = add i32 [[X]], 1 ; CHECK-NEXT: ret i32 [[Y]] ; %y = add i32 %x, 1 diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected @@ -1,4 +1,4 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature ; Check that we accept functions with '$' in the name. ; ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.14.0" diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s --check-prefix=REUSE ; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s --check-prefix=REUSE target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/no-funcsig-for-existing-note.ll b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/no-funcsig-for-existing-note.ll new file mode 100644 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/no-funcsig-for-existing-note.ll @@ -0,0 +1,13 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; This test already has a autogenerated note, so we should not default to +; adding function signature matches since that would cause lots of test churn. +; RUN: opt < %s -passes=instsimplify -S | FileCheck %s + +define i32 @common_sub_operand(i32 %X, i32 %Y) { +; CHECK-LABEL: @common_sub_operand( +; CHECK-NEXT: ret i32 [[X:%.*]] +; + %Z = sub i32 %X, %Y + %Q = add i32 %Z, %Y + ret i32 %Q +} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/no-funcsig-for-existing-note.ll.expected-with-flag b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/no-funcsig-for-existing-note.ll.expected-with-flag new file mode 100644 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/no-funcsig-for-existing-note.ll.expected-with-flag @@ -0,0 +1,14 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature +; This test already has a autogenerated note, so we should not default to +; adding function signature matches since that would cause lots of test churn. +; RUN: opt < %s -passes=instsimplify -S | FileCheck %s + +define i32 @common_sub_operand(i32 %X, i32 %Y) { +; CHECK-LABEL: define {{[^@]+}}@common_sub_operand +; CHECK-SAME: (i32 [[X:%.*]], i32 [[Y:%.*]]) { +; CHECK-NEXT: ret i32 [[X]] +; + %Z = sub i32 %X, %Y + %Q = add i32 %Z, %Y + ret i32 %Q +} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/no-funcsig-for-existing-note.ll.expected-with-negative-flag b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/no-funcsig-for-existing-note.ll.expected-with-negative-flag new file mode 100644 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/no-funcsig-for-existing-note.ll.expected-with-negative-flag @@ -0,0 +1,13 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --no-function-signature +; This test already has a autogenerated note, so we should not default to +; adding function signature matches since that would cause lots of test churn. +; RUN: opt < %s -passes=instsimplify -S | FileCheck %s + +define i32 @common_sub_operand(i32 %X, i32 %Y) { +; CHECK-LABEL: @common_sub_operand( +; CHECK-NEXT: ret i32 [[X:%.*]] +; + %Z = sub i32 %X, %Y + %Q = add i32 %Z, %Y + ret i32 %Q +} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/no-funcsig-for-existing-note.ll.expected-with-unrelated-flag b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/no-funcsig-for-existing-note.ll.expected-with-unrelated-flag new file mode 100644 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/no-funcsig-for-existing-note.ll.expected-with-unrelated-flag @@ -0,0 +1,13 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --scrub-attributes +; This test already has a autogenerated note, so we should not default to +; adding function signature matches since that would cause lots of test churn. +; RUN: opt < %s -passes=instsimplify -S | FileCheck %s + +define i32 @common_sub_operand(i32 %X, i32 %Y) { +; CHECK-LABEL: @common_sub_operand( +; CHECK-NEXT: ret i32 [[X:%.*]] +; + %Z = sub i32 %X, %Y + %Q = add i32 %Z, %Y + ret i32 %Q +} 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 --- 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 @@ -1,4 +1,4 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --scrub-attributes --function-signature ; RUN: opt -S < %s | FileCheck %s declare void @foo() 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 --- 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 @@ -1,4 +1,4 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes --disable +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --scrub-attributes --disable --function-signature ; RUN: opt -S < %s | FileCheck %s declare void @foo() diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll.expected --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll.expected @@ -1,4 +1,4 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature ; RUN: opt -O0 -S < %s | FileCheck %s -check-prefix=A ; RUN: opt -O3 -S < %s | FileCheck %s -check-prefix=A diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.plain.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.plain.expected --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.plain.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.plain.expected @@ -1,10 +1,10 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature ; RUN: opt -S < %s | FileCheck %s declare void @foo() define internal void @bar() { -; CHECK-LABEL: @bar( +; CHECK-LABEL: define {{[^@]+}}@bar() { ; CHECK-NEXT: call void @foo() #[[ATTR0:[0-9]+]] ; CHECK-NEXT: ret void ; diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.scrub.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.scrub.expected --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.scrub.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.scrub.expected @@ -1,10 +1,10 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --scrub-attributes +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --scrub-attributes --function-signature ; RUN: opt -S < %s | FileCheck %s declare void @foo() define internal void @bar() { -; CHECK-LABEL: @bar( +; CHECK-LABEL: define {{[^@]+}}@bar() { ; CHECK-NEXT: call void @foo() ; CHECK-NEXT: ret void ; diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/sometimes_deleted_function.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/sometimes_deleted_function.ll.expected --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/sometimes_deleted_function.ll.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/sometimes_deleted_function.ll.expected @@ -1,4 +1,4 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature ; RUN: opt -S < %s | FileCheck %s --check-prefixes=ALL,ALL_BUT_TWO,ALL_BUT_THREE,ALL_BUT_FOUR,ONE_AND_TWO,ONE_AND_THREE,ONE_AND_FOUR,ONE ; RUN: opt -S -passes=globalopt < %s | FileCheck %s --check-prefixes=ALL,ALL_BUT_ONE,ALL_BUT_THREE,ALL_BUT_FOUR,ONE_AND_TWO,TWO_AND_THREE,TWO_AND_FOUR,TWO ; RUN: opt -S -passes=instsimplify < %s | FileCheck %s --check-prefixes=ALL,ALL_BUT_ONE,ALL_BUT_TWO,ALL_BUT_FOUR,ONE_AND_THREE,TWO_AND_THREE,THREE_AND_FOUR,THREE @@ -8,11 +8,11 @@ ; Also verify we use "ONE_AND_FOUR" for the unmodified @sometimes_here version and "THREE" for the version without the add. define internal void @sometimes_here() { -; ONE_AND_FOUR-LABEL: @sometimes_here( +; ONE_AND_FOUR-LABEL: define {{[^@]+}}@sometimes_here() { ; ONE_AND_FOUR-NEXT: [[C:%.*]] = add i32 undef, undef ; ONE_AND_FOUR-NEXT: ret void ; -; THREE-LABEL: @sometimes_here( +; THREE-LABEL: define {{[^@]+}}@sometimes_here() { ; THREE-NEXT: ret void ; %c = add i32 undef, undef @@ -20,21 +20,23 @@ } define void @always_here() { -; ALL-LABEL: @always_here( -; ALL-NEXT: ret void +; ALL_BUT_TWO-LABEL: define {{[^@]+}}@always_here() { +; ALL_BUT_TWO-NEXT: ret void +; +; TWO-LABEL: define {{[^@]+}}@always_here() local_unnamed_addr { +; TWO-NEXT: ret void ; ret void } ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; ALL: {{.*}} ; ALL_BUT_FOUR: {{.*}} ; ALL_BUT_ONE: {{.*}} ; ALL_BUT_THREE: {{.*}} -; ALL_BUT_TWO: {{.*}} ; FOUR: {{.*}} ; ONE: {{.*}} ; ONE_AND_THREE: {{.*}} ; ONE_AND_TWO: {{.*}} ; THREE_AND_FOUR: {{.*}} -; TWO: {{.*}} ; TWO_AND_FOUR: {{.*}} ; TWO_AND_THREE: {{.*}} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; Just run it through opt, no passes needed. ; RUN: opt < %s -S | FileCheck %s diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected @@ -1,4 +1,4 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-globals +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals --function-signature ; Just run it through opt, no passes needed. ; RUN: opt < %s -S | FileCheck %s diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/basic.test b/llvm/test/tools/UpdateTestChecks/update_test_checks/basic.test --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/basic.test +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/basic.test @@ -5,12 +5,3 @@ ## Check that running the script again does not change the result: # RUN: %update_test_checks %t.ll # RUN: diff -u %t.ll %S/Inputs/basic.ll.expected -## Also try the --function-signature flag -# RUN: %update_test_checks %t.ll --function-signature -# RUN: diff -u %t.ll %S/Inputs/basic.ll.funcsig.expected -## Verify that running without the --function-signature flag does not removes -## the -SAME: lines since the generated file will have --function-signature in -## an UTC_ARGS: comment in the first line (from the invocation above) which is -## added to the update invocation below. -# RUN: %update_test_checks %t.ll -# RUN: diff -u %t.ll %S/Inputs/basic.ll.funcsig.expected diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/no-funcsig-for-existing-note.test b/llvm/test/tools/UpdateTestChecks/update_test_checks/no-funcsig-for-existing-note.test new file mode 100644 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/no-funcsig-for-existing-note.test @@ -0,0 +1,32 @@ +# REQUIRES: x86-registered-target +## Check that we do not add function signature matches for tests that already +## have an autogeneration note since that would cause lots of test churn. +# RUN: cp -f %S/Inputs/no-funcsig-for-existing-note.ll %t.ll && %update_test_checks %t.ll +# RUN: diff -u %t.ll %S/Inputs/no-funcsig-for-existing-note.ll +## Check that running the script again does not change the result: +# RUN: %update_test_checks %t.ll +# RUN: diff -u %t.ll %S/Inputs/no-funcsig-for-existing-note.ll +## Adding an explicit --function-signature flag should add the lines though: +# RUN: %update_test_checks %t.ll --function-signature +# RUN: diff -u %t.ll %S/Inputs/no-funcsig-for-existing-note.ll.expected-with-flag +## Running the script without arguments again should keep the function signature +# RUN: %update_test_checks %t.ll +# RUN: diff -u %t.ll %S/Inputs/no-funcsig-for-existing-note.ll.expected-with-flag + +## Check that an unrelated flag in UTC_ARGS does not implicitly enable --function-signature +# RUN: cp -f %S/Inputs/no-funcsig-for-existing-note.ll.expected-with-unrelated-flag %t.ll && %update_test_checks %t.ll +# RUN: diff -u %t.ll %S/Inputs/no-funcsig-for-existing-note.ll.expected-with-unrelated-flag + +## Check that --function-signature is included in UTC_ARGS for newly generated check lines +# RUN: sed '1d' %S/Inputs/no-funcsig-for-existing-note.ll > %t.ll +# RUN: %update_test_checks %t.ll --update-only 2>&1 | FileCheck %s --check-prefix=SKIP +# SKIP: Skipping test which isn't autogenerated: {{.+}}.ll +# RUN: %update_test_checks %t.ll +# RUN: diff -u %t.ll %S/Inputs/no-funcsig-for-existing-note.ll.expected-with-flag + +## Finally also check --no-function-signature +# RUN: cp -f %S/Inputs/no-funcsig-for-existing-note.ll %t.ll && %update_test_checks %t.ll --no-function-signature +# RUN: diff -u %t.ll %S/Inputs/no-funcsig-for-existing-note.ll.expected-with-negative-flag +## --no-function-signature on the command line does not override the value in UTC_ARGS: +# RUN: cp -f %S/Inputs/no-funcsig-for-existing-note.ll.expected-with-flag %t.ll && %update_test_checks %t.ll --no-function-signature +# RUN: diff -u %t.ll %S/Inputs/no-funcsig-for-existing-note.ll.expected-with-flag diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -57,7 +57,14 @@ result.is_filter_out = copy.deepcopy(self.is_filter_out, memo) return result -def parse_commandline_args(parser): +# We set the default value for --function-signature to 2 which evaluates to True +# in a boolean context, but we use this magic number to ensure that the value +# is actually only set to True for new tests or tests that contain it in +# UTC_ARGS (see itertests). This is needed to avoid lots of test churn. +_FUNCSIG_ARGUMENT_DEFAULT_VALUE = 2 +_FUNCSIG_ARGUMENT_NO_VALUE = None + +def parse_commandline_args(parser, *, add_funcsig_flag=False): class RegexAction(argparse.Action): """Add a regular expression option value to a list of regular expressions. This compiles the expression, wraps it in a Regex and adds it to the option @@ -138,6 +145,13 @@ dest='gen_unused_prefix_body', default=True, help='Generate a function body that always matches for unused prefixes. This is useful when unused prefixes are desired, and it avoids needing to annotate each FileCheck as allowing them.') + if add_funcsig_flag: + parser.add_argument('--function-signature', action='store_true', + default=_FUNCSIG_ARGUMENT_DEFAULT_VALUE, + help='Keep function signature information around for the check line') + parser.add_argument('--no-function-signature', action='store_false', + dest="function_signature", + help='Do not keep function signature information around for the check line') args = parser.parse_args() global _verbose, _global_value_regex, _global_hex_value_regex _verbose = args.verbose @@ -235,7 +249,13 @@ if script_name not in first_line and not args.force_update: warn("Skipping test which wasn't autogenerated by " + script_name, test) continue + # The following if statement is a workaround to avoid major test churn + # by only enabling --function-signature by default for new test but not + # tests with existing check lines. args, argv = check_for_command(first_line, parser, args, argv, argparse_callback) + if getattr(args, "function_signature", None) == _FUNCSIG_ARGUMENT_DEFAULT_VALUE: + # NB: not False to avoid modifying UTC_ARGS + args.function_signature = _FUNCSIG_ARGUMENT_NO_VALUE elif args.update_only: assert UTC_ADVERT not in first_line warn("Skipping test which isn't autogenerated: " + test) @@ -1162,6 +1182,11 @@ 'llc_binary', 'clang', 'opt', 'llvm_bin', 'verbose'): continue value = getattr(args, action.dest) + if action.dest == 'function_signature': + if value is _FUNCSIG_ARGUMENT_NO_VALUE: + continue # Don't add --no-function-signature to existing tests + if value is _FUNCSIG_ARGUMENT_DEFAULT_VALUE: + value = True # Ensure we add --function-signature to new tests. if action.const is not None: # action stores a constant (usually True/False) # Skip actions with different constant values (this happens with boolean # --foo/--no-foo options) diff --git a/llvm/utils/update_test_checks.py b/llvm/utils/update_test_checks.py --- a/llvm/utils/update_test_checks.py +++ b/llvm/utils/update_test_checks.py @@ -53,8 +53,6 @@ '--function', help='The function in the test file to update') parser.add_argument('-p', '--preserve-names', action='store_true', help='Do not scrub IR names') - parser.add_argument('--function-signature', action='store_true', - help='Keep function signature information around for the check line') parser.add_argument('--scrub-attributes', action='store_true', help='Remove attribute annotations (#0) from the end of check line') parser.add_argument('--check-attributes', action='store_true', @@ -62,7 +60,7 @@ parser.add_argument('--check-globals', action='store_true', help='Check global entries (global variables, metadata, attribute sets, ...) for functions') parser.add_argument('tests', nargs='+') - initial_args = common.parse_commandline_args(parser) + initial_args = common.parse_commandline_args(parser, add_funcsig_flag=True) script_name = os.path.basename(__file__)