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=1 -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=1 -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; See PR26774
8
9define i32 @baz() {
10; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
11; IS__TUNIT____-LABEL: define {{[^@]+}}@baz
12; IS__TUNIT____-SAME: () [[ATTR0:#.*]] {
13; IS__TUNIT____-NEXT:    ret i32 10
14;
15; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
16; IS__CGSCC____-LABEL: define {{[^@]+}}@baz
17; IS__CGSCC____-SAME: () [[ATTR0:#.*]] {
18; IS__CGSCC____-NEXT:    ret i32 10
19;
20  ret i32 10
21}
22
23; We can const-prop @baz's return value *into* @foo, but cannot
24; constprop @foo's return value into bar.
25
26define linkonce_odr i32 @foo() {
27; CHECK-LABEL: define {{[^@]+}}@foo() {
28; CHECK-NEXT:    ret i32 10
29;
30
31  %val = call i32 @baz()
32  ret i32 %val
33}
34
35define i32 @bar() {
36; CHECK-LABEL: define {{[^@]+}}@bar() {
37; CHECK-NEXT:    [[VAL:%.*]] = call i32 @foo()
38; CHECK-NEXT:    ret i32 [[VAL]]
39;
40
41  %val = call i32 @foo()
42  ret i32 %val
43}
44