brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 88cdaae Raw
51 lines · plain
1; RUN: opt < %s -passes=inline -inline-threshold=100 -S | FileCheck %s2 3;; caller1/caller2/callee1/callee2 test functions with incompatible attributes4;; won't be inlined into each other.5 6define i32 @callee1(i32 %x) {7  %x1 = add i32 %x, 18  %x2 = add i32 %x1, 19  %x3 = add i32 %x2, 110  call void @extern()11  ret i32 %x312}13 14define i32 @callee2(i32 %x) #0 {15  %x1 = add i32 %x, 116  %x2 = add i32 %x1, 117  %x3 = add i32 %x2, 118  call void @extern()19  ret i32 %x320}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, so26;; callee1 can be inlined into caller1.27; CHECK-LABEL: @caller1(28; CHECK: call i32 @callee229; CHECK-NOT: call i32 @callee130  %y2 = call i32 @callee2(i32 %y1)31  %y3 = call i32 @callee1(i32 %y2)32  ret i32 %y333}34 35define i32 @caller2(i32 %y1) #0 {36;; caller2 and callee2 both have use-sample-profile attribute, so37;; 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 @callee242; CHECK: call i32 @callee143  %y2 = call i32 @callee2(i32 %y1)44  %y3 = call i32 @callee1(i32 %y2)45  ret i32 %y346}47 48declare void @extern()49 50attributes #0 = { "use-sample-profile" }51