1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
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
7define internal i32 @testf(i1 %c) {
8; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
9; IS__CGSCC____-LABEL: define {{[^@]+}}@testf
10; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR0:[0-9]+]] {
11; IS__CGSCC____-NEXT:  entry:
12; IS__CGSCC____-NEXT:    br i1 [[C]], label [[IF_COND:%.*]], label [[IF_END:%.*]]
13; IS__CGSCC____:       if.cond:
14; IS__CGSCC____-NEXT:    unreachable
15; IS__CGSCC____:       if.then:
16; IS__CGSCC____-NEXT:    unreachable
17; IS__CGSCC____:       if.end:
18; IS__CGSCC____-NEXT:    ret i32 10
19;
20entry:
21  br i1 %c, label %if.cond, label %if.end
22
23if.cond:
24  br i1 undef, label %if.then, label %if.end
25
26if.then:                                          ; preds = %entry, %if.then
27  ret i32 11
28
29if.end:                                          ; preds = %if.then1, %entry
30  ret i32 10
31}
32
33define internal i32 @test1(i1 %c) {
34; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn
35; IS__CGSCC____-LABEL: define {{[^@]+}}@test1
36; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1:[0-9]+]] {
37; IS__CGSCC____-NEXT:  entry:
38; IS__CGSCC____-NEXT:    br label [[IF_THEN:%.*]]
39; IS__CGSCC____:       if.then:
40; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call i32 @testf(i1 [[C]]) #[[ATTR2:[0-9]+]]
41; IS__CGSCC____-NEXT:    [[RES:%.*]] = icmp eq i32 [[CALL]], 10
42; IS__CGSCC____-NEXT:    br i1 [[RES]], label [[RET1:%.*]], label [[RET2:%.*]]
43; IS__CGSCC____:       ret1:
44; IS__CGSCC____-NEXT:    ret i32 99
45; IS__CGSCC____:       ret2:
46; IS__CGSCC____-NEXT:    ret i32 0
47;
48entry:
49  br label %if.then
50
51if.then:                                          ; preds = %entry, %if.then
52  %call = call i32 @testf(i1 %c)
53  %res = icmp eq i32 %call, 10
54  br i1 %res, label %ret1, label %ret2
55
56ret1:                                           ; preds = %if.then, %entry
57  ret i32 99
58
59ret2:                                           ; preds = %if.then, %entry
60  ret i32 0
61}
62
63define i32 @main(i1 %c) {
64; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
65; IS__TUNIT____-LABEL: define {{[^@]+}}@main
66; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR0:[0-9]+]] {
67; IS__TUNIT____-NEXT:    ret i32 99
68;
69; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn
70; IS__CGSCC____-LABEL: define {{[^@]+}}@main
71; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
72; IS__CGSCC____-NEXT:    [[RES:%.*]] = call noundef i32 @test1(i1 [[C]]) #[[ATTR2]]
73; IS__CGSCC____-NEXT:    ret i32 [[RES]]
74;
75  %res = call i32 @test1(i1 %c)
76  ret i32 %res
77}
78;.
79; IS__TUNIT____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
80;.
81; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
82; IS__CGSCC____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
83; IS__CGSCC____: attributes #[[ATTR2]] = { readnone willreturn }
84;.
85