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
7target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
8target triple = "x86_64-unknown-linux-gnu"
9
10define i64 @fn2() {
11;
12; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
13; IS__TUNIT____-LABEL: define {{[^@]+}}@fn2
14; IS__TUNIT____-SAME: () #[[ATTR0:[0-9]+]] {
15; IS__TUNIT____-NEXT:  entry:
16; IS__TUNIT____-NEXT:    ret i64 undef
17;
18; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn
19; IS__CGSCC____-LABEL: define {{[^@]+}}@fn2
20; IS__CGSCC____-SAME: () #[[ATTR0:[0-9]+]] {
21; IS__CGSCC____-NEXT:  entry:
22; IS__CGSCC____-NEXT:    [[CONV:%.*]] = sext i32 undef to i64
23; IS__CGSCC____-NEXT:    [[DIV:%.*]] = sdiv i64 8, [[CONV]]
24; IS__CGSCC____-NEXT:    [[CALL2:%.*]] = call i64 @fn1(i64 [[DIV]]) #[[ATTR2:[0-9]+]]
25; IS__CGSCC____-NEXT:    ret i64 [[CALL2]]
26;
27entry:
28  %conv = sext i32 undef to i64
29  %div = sdiv i64 8, %conv
30  %call2 = call i64 @fn1(i64 %div)
31  ret i64 %call2
32}
33
34define i64 @fn2b(i32 %arg) {
35;
36; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
37; IS__TUNIT____-LABEL: define {{[^@]+}}@fn2b
38; IS__TUNIT____-SAME: (i32 [[ARG:%.*]]) #[[ATTR0]] {
39; IS__TUNIT____-NEXT:  entry:
40; IS__TUNIT____-NEXT:    [[CONV:%.*]] = sext i32 [[ARG]] to i64
41; IS__TUNIT____-NEXT:    [[DIV:%.*]] = sdiv i64 8, [[CONV]]
42; IS__TUNIT____-NEXT:    ret i64 [[DIV]]
43;
44; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn
45; IS__CGSCC____-LABEL: define {{[^@]+}}@fn2b
46; IS__CGSCC____-SAME: (i32 [[ARG:%.*]]) #[[ATTR0]] {
47; IS__CGSCC____-NEXT:  entry:
48; IS__CGSCC____-NEXT:    [[CONV:%.*]] = sext i32 [[ARG]] to i64
49; IS__CGSCC____-NEXT:    [[DIV:%.*]] = sdiv i64 8, [[CONV]]
50; IS__CGSCC____-NEXT:    [[CALL2:%.*]] = call i64 @fn1(i64 [[DIV]]) #[[ATTR2]]
51; IS__CGSCC____-NEXT:    ret i64 [[CALL2]]
52;
53entry:
54  %conv = sext i32 %arg to i64
55  %div = sdiv i64 8, %conv
56  %call2 = call i64 @fn1(i64 %div)
57  ret i64 %call2
58}
59
60define i64 @fn2c() {
61; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
62; IS__TUNIT____-LABEL: define {{[^@]+}}@fn2c
63; IS__TUNIT____-SAME: () #[[ATTR0]] {
64; IS__TUNIT____-NEXT:  entry:
65; IS__TUNIT____-NEXT:    ret i64 42
66;
67; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn
68; IS__CGSCC____-LABEL: define {{[^@]+}}@fn2c
69; IS__CGSCC____-SAME: () #[[ATTR0]] {
70; IS__CGSCC____-NEXT:  entry:
71; IS__CGSCC____-NEXT:    [[CONV:%.*]] = sext i32 undef to i64
72; IS__CGSCC____-NEXT:    [[ADD:%.*]] = add i64 42, [[CONV]]
73; IS__CGSCC____-NEXT:    [[CALL2:%.*]] = call i64 @fn1(i64 [[ADD]]) #[[ATTR2]]
74; IS__CGSCC____-NEXT:    ret i64 [[CALL2]]
75;
76entry:
77  %conv = sext i32 undef to i64
78  %add = add i64 42, %conv
79  %call2 = call i64 @fn1(i64 %add)
80  ret i64 %call2
81}
82
83define internal i64 @fn1(i64 %p1) {
84; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
85; IS__CGSCC____-LABEL: define {{[^@]+}}@fn1
86; IS__CGSCC____-SAME: (i64 returned [[P1:%.*]]) #[[ATTR1:[0-9]+]] {
87; IS__CGSCC____-NEXT:  entry:
88; IS__CGSCC____-NEXT:    ret i64 [[P1]]
89;
90entry:
91  %tobool = icmp ne i64 %p1, 0
92  %cond = select i1 %tobool, i64 %p1, i64 %p1
93  ret i64 %cond
94}
95;.
96; IS__TUNIT____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
97;.
98; IS__CGSCC____: attributes #[[ATTR0]] = { nofree nosync nounwind readnone willreturn }
99; IS__CGSCC____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
100; IS__CGSCC____: attributes #[[ATTR2]] = { readnone willreturn }
101;.
102