brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · b8f9a23 Raw
54 lines · plain
1; RUN: opt < %s -passes=inline -S | FileCheck %s2; RUN: opt < %s --passes=inline -S | FileCheck %s3 4; Test that functions with attribute optnone are not inlined.5; Also test that only functions with attribute alwaysinline are6; valid candidates for inlining if the caller has the optnone attribute.7 8; Function Attrs: alwaysinline nounwind readnone uwtable9define i32 @alwaysInlineFunction(i32 %a) #0 {10entry:11  %mul = mul i32 %a, %a12  ret i32 %mul13}14 15; Function Attrs: nounwind readnone uwtable16define i32 @simpleFunction(i32 %a) #1 {17entry:18  %add = add i32 %a, %a19  ret i32 %add20}21 22; Function Attrs: nounwind noinline optnone readnone uwtable23define i32 @OptnoneFunction(i32 %a) #2 {24entry:25  %0 = tail call i32 @alwaysInlineFunction(i32 %a)26  %1 = tail call i32 @simpleFunction(i32 %a)27  %add = add i32 %0, %128  ret i32 %add29}30 31; CHECK-LABEL: @OptnoneFunction32; CHECK-NOT: call i32 @alwaysInlineFunction(i32 %a)33; CHECK: call i32 @simpleFunction(i32 %a)34; CHECK: ret35 36; Function Attrs: nounwind readnone uwtable37define i32 @bar(i32 %a) #1 {38entry:39  %0 = tail call i32 @OptnoneFunction(i32 5)40  %1 = tail call i32 @simpleFunction(i32 6)41  %add = add i32 %0, %142  ret i32 %add43}44 45; CHECK-LABEL: @bar46; CHECK: call i32 @OptnoneFunction(i32 5)47; CHECK-NOT: call i32 @simpleFunction(i32 6)48; CHECK: ret49 50 51attributes #0 = { alwaysinline nounwind readnone uwtable }52attributes #1 = { nounwind readnone uwtable }53attributes #2 = { nounwind noinline optnone readnone uwtable }54