1; RUN: opt < %s -passes=inline -inline-threshold=100 -S | FileCheck %s 2 3;; caller1/caller2/callee1/callee2 test functions with incompatible attributes 4;; won't be inlined into each other. 5 6define i32 @callee1(i32 %x) { 7 %x1 = add i32 %x, 1 8 %x2 = add i32 %x1, 1 9 %x3 = add i32 %x2, 1 10 call void @extern() 11 ret i32 %x3 12} 13 14define i32 @callee2(i32 %x) #0 { 15 %x1 = add i32 %x, 1 16 %x2 = add i32 %x1, 1 17 %x3 = add i32 %x2, 1 18 call void @extern() 19 ret i32 %x3 20} 21 22define 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) 32 ret i32 %y3 33} 34 35define 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) 45 ret i32 %y3 46} 47 48declare void @extern() 49 50attributes #0 = { "use-sample-profile" } 51