1 ; RUN: opt < %s -passes=inline -inline-threshold=100 -S | FileCheck %s
3 ;; caller1/caller2/callee1/callee2 test functions with incompatible attributes
4 ;; won't be inlined into each other.
6 define i32 @callee1(i32 %x) {
14 define i32 @callee2(i32 %x) #0 {
22 define i32 @caller1(i32 %y1) {
23 ;; caller1 doesn't have use-sample-profile attribute but callee2 has,
24 ;; so callee2 won't be inlined into caller1.
25 ;; caller1 and callee1 don't have use-sample-profile attribute, so
26 ;; callee1 can be inlined into caller1.
27 ; CHECK-LABEL: @caller1(
28 ; CHECK: call i32 @callee2
29 ; CHECK-NOT: call i32 @callee1
30 %y2 = call i32 @callee2(i32 %y1)
31 %y3 = call i32 @callee1(i32 %y2)
35 define i32 @caller2(i32 %y1) #0 {
36 ;; caller2 and callee2 both have use-sample-profile attribute, so
37 ;; callee2 can be inlined into caller2.
38 ;; caller2 has use-sample-profile attribute but callee1 doesn't have,
39 ;; so callee1 won't be inlined into caller2.
40 ; CHECK-LABEL: @caller2(
41 ; CHECK-NOT: call i32 @callee2
42 ; CHECK: call i32 @callee1
43 %y2 = call i32 @callee2(i32 %y1)
44 %y3 = call i32 @callee1(i32 %y2)
48 declare void @extern()
50 attributes #0 = { "use-sample-profile" }