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 poison
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:    ret i64 poison
23;
24entry:
25  %conv = sext i32 undef to i64
26  %div = sdiv i64 8, %conv
27  %call2 = call i64 @fn1(i64 %div)
28  ret i64 %call2
29}
30
31define i64 @fn2b(i32 %arg) {
32;
33; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
34; IS__TUNIT____-LABEL: define {{[^@]+}}@fn2b
35; IS__TUNIT____-SAME: (i32 [[ARG:%.*]]) #[[ATTR0]] {
36; IS__TUNIT____-NEXT:  entry:
37; IS__TUNIT____-NEXT:    [[CONV:%.*]] = sext i32 [[ARG]] to i64
38; IS__TUNIT____-NEXT:    [[DIV:%.*]] = sdiv i64 8, [[CONV]]
39; IS__TUNIT____-NEXT:    ret i64 [[DIV]]
40;
41; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn
42; IS__CGSCC____-LABEL: define {{[^@]+}}@fn2b
43; IS__CGSCC____-SAME: (i32 [[ARG:%.*]]) #[[ATTR0]] {
44; IS__CGSCC____-NEXT:  entry:
45; IS__CGSCC____-NEXT:    [[CONV:%.*]] = sext i32 [[ARG]] to i64
46; IS__CGSCC____-NEXT:    [[DIV:%.*]] = sdiv i64 8, [[CONV]]
47; IS__CGSCC____-NEXT:    ret i64 [[DIV]]
48;
49entry:
50  %conv = sext i32 %arg to i64
51  %div = sdiv i64 8, %conv
52  %call2 = call i64 @fn1(i64 %div)
53  ret i64 %call2
54}
55
56define i64 @fn2c() {
57; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
58; IS__TUNIT____-LABEL: define {{[^@]+}}@fn2c
59; IS__TUNIT____-SAME: () #[[ATTR0]] {
60; IS__TUNIT____-NEXT:  entry:
61; IS__TUNIT____-NEXT:    ret i64 42
62;
63; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn
64; IS__CGSCC____-LABEL: define {{[^@]+}}@fn2c
65; IS__CGSCC____-SAME: () #[[ATTR0]] {
66; IS__CGSCC____-NEXT:  entry:
67; IS__CGSCC____-NEXT:    ret i64 42
68;
69entry:
70  %conv = sext i32 undef to i64
71  %add = add i64 42, %conv
72  %call2 = call i64 @fn1(i64 %add)
73  ret i64 %call2
74}
75
76define internal i64 @fn1(i64 %p1) {
77; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
78; IS__CGSCC____-LABEL: define {{[^@]+}}@fn1
79; IS__CGSCC____-SAME: (i64 returned [[P1:%.*]]) #[[ATTR1:[0-9]+]] {
80; IS__CGSCC____-NEXT:  entry:
81; IS__CGSCC____-NEXT:    [[TOBOOL:%.*]] = icmp ne i64 [[P1]], 0
82; IS__CGSCC____-NEXT:    [[COND:%.*]] = select i1 [[TOBOOL]], i64 [[P1]], i64 [[P1]]
83; IS__CGSCC____-NEXT:    ret i64 [[COND]]
84;
85entry:
86  %tobool = icmp ne i64 %p1, 0
87  %cond = select i1 %tobool, i64 %p1, i64 %p1
88  ret i64 %cond
89}
90;.
91; IS__TUNIT____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
92;.
93; IS__CGSCC____: attributes #[[ATTR0]] = { nofree nosync nounwind readnone willreturn }
94; IS__CGSCC____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
95;.
96