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