1 ; RUN: opt < %s -inline -S | FileCheck %s
2 ; RUN: opt < %s --passes=inline -S | FileCheck %s
4 ; Test that functions with attribute optnone are not inlined.
5 ; Also test that only functions with attribute alwaysinline are
6 ; valid candidates for inlining if the caller has the optnone attribute.
8 ; Function Attrs: alwaysinline nounwind readnone uwtable
9 define i32 @alwaysInlineFunction(i32 %a) #0 {
15 ; Function Attrs: nounwind readnone uwtable
16 define i32 @simpleFunction(i32 %a) #1 {
22 ; Function Attrs: nounwind noinline optnone readnone uwtable
23 define i32 @OptnoneFunction(i32 %a) #2 {
25 %0 = tail call i32 @alwaysInlineFunction(i32 %a)
26 %1 = tail call i32 @simpleFunction(i32 %a)
31 ; CHECK-LABEL: @OptnoneFunction
32 ; CHECK-NOT: call i32 @alwaysInlineFunction(i32 %a)
33 ; CHECK: call i32 @simpleFunction(i32 %a)
36 ; Function Attrs: nounwind readnone uwtable
37 define i32 @bar(i32 %a) #1 {
39 %0 = tail call i32 @OptnoneFunction(i32 5)
40 %1 = tail call i32 @simpleFunction(i32 6)
46 ; CHECK: call i32 @OptnoneFunction(i32 5)
47 ; CHECK-NOT: call i32 @simpleFunction(i32 6)
51 attributes #0 = { alwaysinline nounwind readnone uwtable }
52 attributes #1 = { nounwind readnone uwtable }
53 attributes #2 = { nounwind noinline optnone readnone uwtable }