blob: c434774c9a5e5ad15b7586cc93028950055302e1 [file] [log] [blame]
Johannes Doerfert9c2074d2021-03-11 23:21:32 -06001; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
Arthur Eubanks4a100292020-07-28 17:57:21 -07002; 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
Johannes Doerferte2b53a42020-04-17 21:09:16 -05003; 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
Arthur Eubanks4a100292020-07-28 17:57:21 -07004; 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
Johannes Doerferte2b53a42020-04-17 21:09:16 -05005; 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
Johannes Doerfert3da7efe2019-11-01 23:37:04 -05006
7; See PR26774
8
9define i32 @baz() {
sstefan1e3d646c2020-07-19 21:55:43 +020010; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan16ce5b74b2020-08-29 19:31:13 +020011; IS__TUNIT____-LABEL: define {{[^@]+}}@baz
Johannes Doerfert9c2074d2021-03-11 23:21:32 -060012; IS__TUNIT____-SAME: () #[[ATTR0:[0-9]+]] {
sstefan1e3d646c2020-07-19 21:55:43 +020013; IS__TUNIT____-NEXT: ret i32 10
14;
15; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
sstefan16ce5b74b2020-08-29 19:31:13 +020016; IS__CGSCC____-LABEL: define {{[^@]+}}@baz
Johannes Doerfert9c2074d2021-03-11 23:21:32 -060017; IS__CGSCC____-SAME: () #[[ATTR0:[0-9]+]] {
sstefan1e3d646c2020-07-19 21:55:43 +020018; IS__CGSCC____-NEXT: ret i32 10
Johannes Doerfert3da7efe2019-11-01 23:37:04 -050019;
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() {
sstefan16ce5b74b2020-08-29 19:31:13 +020027; CHECK-LABEL: define {{[^@]+}}@foo() {
Johannes Doerfert3da7efe2019-11-01 23:37:04 -050028; CHECK-NEXT: ret i32 10
29;
30
31 %val = call i32 @baz()
32 ret i32 %val
33}
34
35define i32 @bar() {
sstefan16ce5b74b2020-08-29 19:31:13 +020036; CHECK-LABEL: define {{[^@]+}}@bar() {
Johannes Doerfert3da7efe2019-11-01 23:37:04 -050037; CHECK-NEXT: [[VAL:%.*]] = call i32 @foo()
38; CHECK-NEXT: ret i32 [[VAL]]
39;
40
41 %val = call i32 @foo()
42 ret i32 %val
43}
Johannes Doerfert9c2074d2021-03-11 23:21:32 -060044;.
45; IS__TUNIT____: attributes #[[ATTR0]] = { nofree nosync nounwind readnone willreturn }
46;.
47; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
48;.