1 ; RUN: opt < %s -inline -S | FileCheck %s
3 ; Test that functions with attribute optnone are not inlined.
4 ; Also test that only functions with attribute alwaysinline are
5 ; valid candidates for inlining if the caller has the optnone attribute.
7 ; Function Attrs: alwaysinline nounwind readnone uwtable
8 define i32 @alwaysInlineFunction(i32 %a) #0 {
14 ; Function Attrs: nounwind readnone uwtable
15 define i32 @simpleFunction(i32 %a) #1 {
21 ; Function Attrs: nounwind noinline optnone readnone uwtable
22 define i32 @OptnoneFunction(i32 %a) #2 {
24 %0 = tail call i32 @alwaysInlineFunction(i32 %a)
25 %1 = tail call i32 @simpleFunction(i32 %a)
30 ; CHECK-LABEL: @OptnoneFunction
31 ; CHECK-NOT: call i32 @alwaysInlineFunction(i32 %a)
32 ; CHECK: call i32 @simpleFunction(i32 %a)
35 ; Function Attrs: nounwind readnone uwtable
36 define i32 @bar(i32 %a) #1 {
38 %0 = tail call i32 @OptnoneFunction(i32 5)
39 %1 = tail call i32 @simpleFunction(i32 6)
45 ; CHECK: call i32 @OptnoneFunction(i32 5)
46 ; CHECK-NOT: call i32 @simpleFunction(i32 6)
50 attributes #0 = { alwaysinline nounwind readnone uwtable }
51 attributes #1 = { nounwind readnone uwtable }
52 attributes #2 = { nounwind noinline optnone readnone uwtable }