Skip to content

Commit 2bcf579

Browse files
committed
[Attributor] Unify testing (=updates,prefixes,run configurations,...)
When the Attributor was created the test update scripts were not well suited to deal with the challenges of IR attribute checking. This partially improved. Since then we also added three additional configurations that need testing; in total we now have the following four: { TUNIT, CGSCC } x { old pass manager (OPM), new pass manager (NPM) } Finally, the number of developers and tests grew rapidly (partially due to the addition of ArgumentPromotion and IPConstantProp tests), which resulted in tests only being run in some configurations, different prefixes being used, and different "styles" of checks being used. Due to the above reasons I believed we needed to take another look at the test update scripts. While we started to use them, via UTC_ARGS: --enable/disable, the other problems remained. To improve the testing situation for *all* configurations, to simplify future updates to the test, and to help identify subtle effects of future changes, we now use the test update scripts for (almost) all Attributor tests. An exhaustive prefix list minimizes the number of check lines and makes it easy to identify and compare configurations. Tests have been adjusted in the process but we tried to keep their intend unchanged. Reviewed By: sstefan1 Differential Revision: https://reviews.llvm.org/D76588
1 parent cb0ecc5 commit 2bcf579

File tree

87 files changed

+9516
-5511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+9516
-5511
lines changed

llvm/test/Transforms/Attributor/ArgumentPromotion/2008-02-01-ReturnAttrs.ll

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,60 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
2-
; RUN: opt -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=6 -S < %s | FileCheck %s
2+
; RUN: opt -attributor -attributor-manifest-internal -attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
3+
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
4+
; RUN: opt -attributor-cgscc -attributor-manifest-internal -attributor-disable=false -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
5+
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-disable=false -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
36

47
define internal i32 @deref(i32* %x) nounwind {
5-
; CHECK-LABEL: define {{[^@]+}}@deref
6-
; CHECK-SAME: (i32 [[TMP0:%.*]])
7-
; CHECK-NEXT: entry:
8-
; CHECK-NEXT: [[X_PRIV:%.*]] = alloca i32
9-
; CHECK-NEXT: store i32 [[TMP0]], i32* [[X_PRIV]]
10-
; CHECK-NEXT: [[TMP2:%.*]] = load i32, i32* [[X_PRIV]], align 4
11-
; CHECK-NEXT: ret i32 [[TMP2]]
8+
; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@deref
9+
; IS__TUNIT_OPM-SAME: (i32* noalias nocapture nofree nonnull readonly align 4 dereferenceable(4) [[X:%.*]])
10+
; IS__TUNIT_OPM-NEXT: entry:
11+
; IS__TUNIT_OPM-NEXT: [[TMP2:%.*]] = load i32, i32* [[X]], align 4
12+
; IS__TUNIT_OPM-NEXT: ret i32 [[TMP2]]
13+
;
14+
; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@deref
15+
; IS__TUNIT_NPM-SAME: (i32 [[TMP0:%.*]])
16+
; IS__TUNIT_NPM-NEXT: entry:
17+
; IS__TUNIT_NPM-NEXT: [[X_PRIV:%.*]] = alloca i32
18+
; IS__TUNIT_NPM-NEXT: store i32 [[TMP0]], i32* [[X_PRIV]]
19+
; IS__TUNIT_NPM-NEXT: [[TMP2:%.*]] = load i32, i32* [[X_PRIV]], align 4
20+
; IS__TUNIT_NPM-NEXT: ret i32 [[TMP2]]
21+
;
22+
; IS__CGSCC____-LABEL: define {{[^@]+}}@deref
23+
; IS__CGSCC____-SAME: (i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) [[X:%.*]])
24+
; IS__CGSCC____-NEXT: entry:
25+
; IS__CGSCC____-NEXT: [[TMP2:%.*]] = load i32, i32* [[X]], align 4
26+
; IS__CGSCC____-NEXT: ret i32 [[TMP2]]
1227
;
1328
entry:
1429
%tmp2 = load i32, i32* %x, align 4
1530
ret i32 %tmp2
1631
}
1732

1833
define i32 @f(i32 %x) {
19-
; CHECK-LABEL: define {{[^@]+}}@f
20-
; CHECK-SAME: (i32 [[X:%.*]])
21-
; CHECK-NEXT: entry:
22-
; CHECK-NEXT: [[X_ADDR:%.*]] = alloca i32
23-
; CHECK-NEXT: store i32 [[X]], i32* [[X_ADDR]], align 4
24-
; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[X_ADDR]], align 1
25-
; CHECK-NEXT: [[TMP1:%.*]] = call i32 @deref(i32 [[TMP0]])
26-
; CHECK-NEXT: ret i32 [[TMP1]]
34+
; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@f
35+
; IS__TUNIT_OPM-SAME: (i32 [[X:%.*]])
36+
; IS__TUNIT_OPM-NEXT: entry:
37+
; IS__TUNIT_OPM-NEXT: [[X_ADDR:%.*]] = alloca i32
38+
; IS__TUNIT_OPM-NEXT: store i32 [[X]], i32* [[X_ADDR]], align 4
39+
; IS__TUNIT_OPM-NEXT: [[TMP1:%.*]] = call i32 @deref(i32* noalias nocapture nofree nonnull readonly align 4 dereferenceable(4) [[X_ADDR]])
40+
; IS__TUNIT_OPM-NEXT: ret i32 [[TMP1]]
41+
;
42+
; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@f
43+
; IS__TUNIT_NPM-SAME: (i32 [[X:%.*]])
44+
; IS__TUNIT_NPM-NEXT: entry:
45+
; IS__TUNIT_NPM-NEXT: [[X_ADDR:%.*]] = alloca i32
46+
; IS__TUNIT_NPM-NEXT: store i32 [[X]], i32* [[X_ADDR]], align 4
47+
; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32, i32* [[X_ADDR]], align 1
48+
; IS__TUNIT_NPM-NEXT: [[TMP1:%.*]] = call i32 @deref(i32 [[TMP0]])
49+
; IS__TUNIT_NPM-NEXT: ret i32 [[TMP1]]
50+
;
51+
; IS__CGSCC____-LABEL: define {{[^@]+}}@f
52+
; IS__CGSCC____-SAME: (i32 [[X:%.*]])
53+
; IS__CGSCC____-NEXT: entry:
54+
; IS__CGSCC____-NEXT: [[X_ADDR:%.*]] = alloca i32
55+
; IS__CGSCC____-NEXT: store i32 [[X]], i32* [[X_ADDR]], align 4
56+
; IS__CGSCC____-NEXT: [[TMP1:%.*]] = call i32 @deref(i32* noalias nofree nonnull readonly align 4 dereferenceable(4) [[X_ADDR]])
57+
; IS__CGSCC____-NEXT: ret i32 [[TMP1]]
2758
;
2859
entry:
2960
%x_addr = alloca i32

llvm/test/Transforms/Attributor/ArgumentPromotion/2008-07-02-array-indexing.ll

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
2-
; RUN: opt -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=3 -S < %s | FileCheck %s
2+
; RUN: opt -attributor -attributor-manifest-internal -attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
3+
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
4+
; RUN: opt -attributor-cgscc -attributor-manifest-internal -attributor-disable=false -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
5+
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-disable=false -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
36
; PR2498
47

58
; This test tries to convince CHECK about promoting the load from %A + 2,
69
; because there is a load of %A in the entry block
710
define internal i32 @callee(i1 %C, i32* %A) {
11+
;
812
; CHECK-LABEL: define {{[^@]+}}@callee
913
; CHECK-SAME: (i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) [[A:%.*]])
1014
; CHECK-NEXT: entry:
11-
; CHECK-NEXT: [[A_0:%.*]] = load i32, i32* %A
15+
; CHECK-NEXT: [[A_0:%.*]] = load i32, i32* [[A]], align 4
1216
; CHECK-NEXT: br label [[F:%.*]]
1317
; CHECK: T:
1418
; CHECK-NEXT: unreachable
1519
; CHECK: F:
16-
; CHECK-NEXT: [[A_2:%.*]] = getelementptr i32, i32* %A, i32 2
17-
; CHECK-NEXT: [[R:%.*]] = load i32, i32* [[A_2]]
20+
; CHECK-NEXT: [[A_2:%.*]] = getelementptr i32, i32* [[A]], i32 2
21+
; CHECK-NEXT: [[R:%.*]] = load i32, i32* [[A_2]], align 4
1822
; CHECK-NEXT: ret i32 [[R]]
1923
;
2024
entry:
@@ -33,9 +37,15 @@ F:
3337
}
3438

3539
define i32 @foo(i32* %A) {
36-
; CHECK-LABEL: define {{[^@]+}}@foo(
37-
; CHECK-NEXT: [[X:%.*]] = call i32 @callee(i32* nocapture nofree readonly align 4 %A)
38-
; CHECK-NEXT: ret i32 [[X]]
40+
; IS__TUNIT____-LABEL: define {{[^@]+}}@foo
41+
; IS__TUNIT____-SAME: (i32* nocapture nofree readonly [[A:%.*]])
42+
; IS__TUNIT____-NEXT: [[X:%.*]] = call i32 @callee(i32* nocapture nofree readonly align 4 [[A]])
43+
; IS__TUNIT____-NEXT: ret i32 [[X]]
44+
;
45+
; IS__CGSCC____-LABEL: define {{[^@]+}}@foo
46+
; IS__CGSCC____-SAME: (i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) [[A:%.*]])
47+
; IS__CGSCC____-NEXT: [[X:%.*]] = call i32 @callee(i32* nocapture nofree nonnull readonly align 4 dereferenceable(4) [[A]])
48+
; IS__CGSCC____-NEXT: ret i32 [[X]]
3949
;
4050
%X = call i32 @callee(i1 false, i32* %A) ; <i32> [#uses=1]
4151
ret i32 %X

llvm/test/Transforms/Attributor/ArgumentPromotion/2008-09-07-CGUpdate.ll

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
2-
; RUN: opt -disable-output -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s
2+
; RUN: opt -attributor -attributor-manifest-internal -attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=1 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
3+
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=1 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
4+
; RUN: opt -attributor-cgscc -attributor-manifest-internal -attributor-disable=false -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
5+
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-disable=false -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
36

47
define internal fastcc i32 @hash(i32* %ts, i32 %mod) nounwind {
8+
; IS__CGSCC____-LABEL: define {{[^@]+}}@hash()
9+
; IS__CGSCC____-NEXT: entry:
10+
; IS__CGSCC____-NEXT: unreachable
11+
;
512
entry:
613
unreachable
714
}
815

916
define void @encode(i32* %m, i32* %ts, i32* %new) nounwind {
17+
; CHECK-LABEL: define {{[^@]+}}@encode
18+
; CHECK-SAME: (i32* nocapture nofree readnone [[M:%.*]], i32* nocapture nofree readnone [[TS:%.*]], i32* nocapture nofree readnone [[NEW:%.*]])
19+
; CHECK-NEXT: entry:
20+
; CHECK-NEXT: unreachable
21+
;
1022
entry:
1123
%0 = call fastcc i32 @hash( i32* %ts, i32 0 ) nounwind ; <i32> [#uses=0]
1224
unreachable

llvm/test/Transforms/Attributor/ArgumentPromotion/2008-09-08-CGUpdateSelfEdge.ll

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
2-
; RUN: opt -disable-output -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s
2+
; RUN: opt -attributor -attributor-manifest-internal -attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=1 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
3+
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=1 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
4+
; RUN: opt -attributor-cgscc -attributor-manifest-internal -attributor-disable=false -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
5+
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-disable=false -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
36

47
define internal fastcc i32 @term_SharingList(i32* %Term, i32* %List) nounwind {
8+
; IS__CGSCC____-LABEL: define {{[^@]+}}@term_SharingList()
9+
; IS__CGSCC____-NEXT: entry:
10+
; IS__CGSCC____-NEXT: br i1 false, label [[BB:%.*]], label [[BB5:%.*]]
11+
; IS__CGSCC____: bb:
12+
; IS__CGSCC____-NEXT: unreachable
13+
; IS__CGSCC____: bb5:
14+
; IS__CGSCC____-NEXT: ret i32 undef
15+
;
516
entry:
617
br i1 false, label %bb, label %bb5
718

@@ -14,6 +25,15 @@ bb5: ; preds = %entry
1425
}
1526

1627
define i32 @term_Sharing(i32* %Term) nounwind {
28+
; CHECK-LABEL: define {{[^@]+}}@term_Sharing
29+
; CHECK-SAME: (i32* nocapture nofree readnone [[TERM:%.*]])
30+
; CHECK-NEXT: entry:
31+
; CHECK-NEXT: br i1 false, label [[BB_I:%.*]], label [[BB14:%.*]]
32+
; CHECK: bb.i:
33+
; CHECK-NEXT: unreachable
34+
; CHECK: bb14:
35+
; CHECK-NEXT: ret i32 0
36+
;
1737
entry:
1838
br i1 false, label %bb.i, label %bb14
1939

0 commit comments

Comments
 (0)