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; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
13; CHECK-LABEL: define {{[^@]+}}@fn2
14; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
15; CHECK-NEXT:  entry:
16; CHECK-NEXT:    ret i64 poison
17;
18entry:
19  %conv = sext i32 undef to i64
20  %div = sdiv i64 8, %conv
21  %call2 = call i64 @fn1(i64 %div)
22  ret i64 %call2
23}
24
25define i64 @fn2b(i32 %arg) {
26;
27; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
28; CHECK-LABEL: define {{[^@]+}}@fn2b
29; CHECK-SAME: (i32 [[ARG:%.*]]) #[[ATTR0]] {
30; CHECK-NEXT:  entry:
31; CHECK-NEXT:    [[CONV:%.*]] = sext i32 [[ARG]] to i64
32; CHECK-NEXT:    [[DIV:%.*]] = sdiv i64 8, [[CONV]]
33; CHECK-NEXT:    ret i64 [[DIV]]
34;
35entry:
36  %conv = sext i32 %arg to i64
37  %div = sdiv i64 8, %conv
38  %call2 = call i64 @fn1(i64 %div)
39  ret i64 %call2
40}
41
42define i64 @fn2c() {
43; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
44; CHECK-LABEL: define {{[^@]+}}@fn2c
45; CHECK-SAME: () #[[ATTR0]] {
46; CHECK-NEXT:  entry:
47; CHECK-NEXT:    ret i64 42
48;
49entry:
50  %conv = sext i32 undef to i64
51  %add = add i64 42, %conv
52  %call2 = call i64 @fn1(i64 %add)
53  ret i64 %call2
54}
55
56define internal i64 @fn1(i64 %p1) {
57; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
58; IS__CGSCC____-LABEL: define {{[^@]+}}@fn1
59; IS__CGSCC____-SAME: (i64 returned [[P1:%.*]]) #[[ATTR0]] {
60; IS__CGSCC____-NEXT:  entry:
61; IS__CGSCC____-NEXT:    [[TOBOOL:%.*]] = icmp ne i64 [[P1]], 0
62; IS__CGSCC____-NEXT:    [[COND:%.*]] = select i1 [[TOBOOL]], i64 [[P1]], i64 [[P1]]
63; IS__CGSCC____-NEXT:    ret i64 [[COND]]
64;
65entry:
66  %tobool = icmp ne i64 %p1, 0
67  %cond = select i1 %tobool, i64 %p1, i64 %p1
68  ret i64 %cond
69}
70;.
71; CHECK: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
72;.
73