1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes 2; RUN: opt -attributor -attributor-manifest-internal -attributor-disable=false -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-disable=false -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 -attributor-manifest-internal -attributor-disable=false -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-disable=false -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; When a function is marked `alwaysinline` and is able to be inlined, 8; we can IPO its boundaries 9 10; the function is not exactly defined, and marked alwaysinline and can be inlined, 11; so the function can be analyzed 12; CHECK: Function Attrs: alwaysinline 13; CHECK-SAME: willreturn 14define linkonce void @inner1() alwaysinline { 15; CHECK-LABEL: define {{[^@]+}}@inner1() 16; CHECK-NEXT: entry: 17; CHECK-NEXT: ret void 18; 19entry: 20 ret void 21} 22 23; CHECK: Function Attrs: 24; CHECK-SAME: willreturn 25define void @outer1() { 26; CHECK-LABEL: define {{[^@]+}}@outer1() 27; CHECK-NEXT: entry: 28; CHECK-NEXT: ret void 29; 30entry: 31 call void @inner1() 32 ret void 33} 34 35; The function is not alwaysinline and is not exactly defined 36; so it will not be analyzed 37; CHECK-NOT: Function Attrs: 38define linkonce i32 @inner2() { 39; CHECK-LABEL: define {{[^@]+}}@inner2() 40; CHECK-NEXT: entry: 41; CHECK-NEXT: ret i32 1 42; 43entry: 44 ret i32 1 45} 46 47; CHECK-NOT: Function Attrs 48define i32 @outer2() { 49; CHECK-LABEL: define {{[^@]+}}@outer2() 50; CHECK-NEXT: entry: 51; CHECK-NEXT: [[R:%.*]] = call i32 @inner2() 52; CHECK-NEXT: ret i32 [[R]] 53; 54entry: 55 %r = call i32 @inner2() alwaysinline 56 ret i32 %r 57} 58 59; This function cannot be inlined although it is marked alwaysinline 60; it is `unexactly defined` and alwaysinline but cannot be inlined. 61; so it will not be analyzed 62; CHECK: Function Attrs: 63; CHECK-NOT: nofree 64; CHECK-NOT: nosync 65; CHECK-NOT: nounwind 66; CHECK-NOT: readnone 67define linkonce i32 @inner3(i8* %addr) alwaysinline { 68; CHECK-LABEL: define {{[^@]+}}@inner3 69; CHECK-SAME: (i8* [[ADDR:%.*]]) 70; CHECK-NEXT: entry: 71; CHECK-NEXT: indirectbr i8* [[ADDR]], [label [[ONE:%.*]], label %two] 72; CHECK: one: 73; CHECK-NEXT: ret i32 42 74; CHECK: two: 75; CHECK-NEXT: ret i32 44 76; 77entry: 78 indirectbr i8* %addr, [ label %one, label %two ] 79 80one: 81 ret i32 42 82 83two: 84 ret i32 44 85} 86 87; CHECK-NOT: Function Attrs: 88define i32 @outer3(i32 %x) { 89; CHECK-LABEL: define {{[^@]+}}@outer3 90; CHECK-SAME: (i32 [[X:%.*]]) 91; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[X]], 42 92; CHECK-NEXT: [[ADDR:%.*]] = select i1 [[CMP]], i8* blockaddress(@inner3, [[ONE:%.*]]), i8* blockaddress(@inner3, [[TWO:%.*]]) 93; CHECK-NEXT: [[CALL:%.*]] = call i32 @inner3(i8* [[ADDR]]) 94; CHECK-NEXT: ret i32 [[CALL]] 95; 96 %cmp = icmp slt i32 %x, 42 97 %addr = select i1 %cmp, i8* blockaddress(@inner3, %one), i8* blockaddress(@inner3, %two) 98 %call = call i32 @inner3(i8* %addr) 99 ret i32 %call 100} 101