• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes
2; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal  -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -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-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -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 -enable-new-pm=0 -attributor-manifest-internal  -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-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
6
7%S = type { %S* }
8
9; Inlining should nuke the invoke (and any inlined calls) here even with
10; argument promotion running along with it.
11define void @zot() personality i32 (...)* @wibble {
12; IS__TUNIT____: Function Attrs: nofree noreturn nosync nounwind readnone willreturn
13; IS__TUNIT____-LABEL: define {{[^@]+}}@zot
14; IS__TUNIT____-SAME: () [[ATTR0:#.*]] personality i32 (...)* @wibble {
15; IS__TUNIT____-NEXT:  bb:
16; IS__TUNIT____-NEXT:    call void @hoge() [[ATTR1:#.*]]
17; IS__TUNIT____-NEXT:    unreachable
18; IS__TUNIT____:       bb1:
19; IS__TUNIT____-NEXT:    unreachable
20; IS__TUNIT____:       bb2:
21; IS__TUNIT____-NEXT:    unreachable
22;
23; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
24; IS__CGSCC____-LABEL: define {{[^@]+}}@zot
25; IS__CGSCC____-SAME: () [[ATTR0:#.*]] personality i32 (...)* @wibble {
26; IS__CGSCC____-NEXT:  bb:
27; IS__CGSCC____-NEXT:    call void @hoge() [[ATTR2:#.*]]
28; IS__CGSCC____-NEXT:    unreachable
29; IS__CGSCC____:       bb1:
30; IS__CGSCC____-NEXT:    unreachable
31; IS__CGSCC____:       bb2:
32; IS__CGSCC____-NEXT:    unreachable
33;
34bb:
35  invoke void @hoge()
36  to label %bb1 unwind label %bb2
37
38bb1:
39  unreachable
40
41bb2:
42  %tmp = landingpad { i8*, i32 }
43  cleanup
44  unreachable
45}
46
47define internal void @hoge() {
48; IS__TUNIT____: Function Attrs: nofree noreturn nosync nounwind readnone willreturn
49; IS__TUNIT____-LABEL: define {{[^@]+}}@hoge
50; IS__TUNIT____-SAME: () [[ATTR0]] {
51; IS__TUNIT____-NEXT:  bb:
52; IS__TUNIT____-NEXT:    unreachable
53;
54; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
55; IS__CGSCC____-LABEL: define {{[^@]+}}@hoge
56; IS__CGSCC____-SAME: () [[ATTR0]] {
57; IS__CGSCC____-NEXT:  bb:
58; IS__CGSCC____-NEXT:    unreachable
59;
60bb:
61  %tmp = call fastcc i8* @spam(i1 (i8*)* @eggs)
62  %tmp1 = call fastcc i8* @spam(i1 (i8*)* @barney)
63  unreachable
64}
65
66define internal fastcc i8* @spam(i1 (i8*)* %arg) {
67; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
68; IS__CGSCC____-LABEL: define {{[^@]+}}@spam
69; IS__CGSCC____-SAME: () [[ATTR0]] {
70; IS__CGSCC____-NEXT:  bb:
71; IS__CGSCC____-NEXT:    unreachable
72;
73bb:
74  unreachable
75}
76
77define internal i1 @eggs(i8* %arg) {
78bb:
79  %tmp = call zeroext i1 @barney(i8* %arg)
80  unreachable
81}
82
83define internal i1 @barney(i8* %arg) {
84; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
85; IS__CGSCC____-LABEL: define {{[^@]+}}@barney
86; IS__CGSCC____-SAME: () [[ATTR1:#.*]] {
87; IS__CGSCC____-NEXT:  bb:
88; IS__CGSCC____-NEXT:    ret i1 undef
89;
90bb:
91  ret i1 undef
92}
93
94define i32 @test_inf_promote_caller(i32 %arg) {
95; IS__TUNIT____: Function Attrs: nofree noreturn nosync nounwind readnone willreturn
96; IS__TUNIT____-LABEL: define {{[^@]+}}@test_inf_promote_caller
97; IS__TUNIT____-SAME: (i32 [[ARG:%.*]]) [[ATTR0]] {
98; IS__TUNIT____-NEXT:  bb:
99; IS__TUNIT____-NEXT:    unreachable
100;
101; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
102; IS__CGSCC____-LABEL: define {{[^@]+}}@test_inf_promote_caller
103; IS__CGSCC____-SAME: (i32 [[ARG:%.*]]) [[ATTR0]] {
104; IS__CGSCC____-NEXT:  bb:
105; IS__CGSCC____-NEXT:    [[TMP:%.*]] = alloca [[S:%.*]], align 8
106; IS__CGSCC____-NEXT:    [[TMP1:%.*]] = alloca [[S]], align 8
107; IS__CGSCC____-NEXT:    unreachable
108;
109bb:
110  %tmp = alloca %S
111  %tmp1 = alloca %S
112  %tmp2 = call i32 @test_inf_promote_callee(%S* %tmp, %S* %tmp1)
113
114  ret i32 0
115}
116
117define internal i32 @test_inf_promote_callee(%S* %arg, %S* %arg1) {
118; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
119; IS__CGSCC____-LABEL: define {{[^@]+}}@test_inf_promote_callee
120; IS__CGSCC____-SAME: () [[ATTR0]] {
121; IS__CGSCC____-NEXT:  bb:
122; IS__CGSCC____-NEXT:    unreachable
123;
124bb:
125  %tmp = getelementptr %S, %S* %arg1, i32 0, i32 0
126  %tmp2 = load %S*, %S** %tmp
127  %tmp3 = getelementptr %S, %S* %arg, i32 0, i32 0
128  %tmp4 = load %S*, %S** %tmp3
129  %tmp5 = call i32 @test_inf_promote_callee(%S* %tmp4, %S* %tmp2)
130
131  ret i32 0
132}
133
134declare i32 @wibble(...)
135