76 lines · plain
1; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S -inlinecold-threshold=25 | FileCheck %s2; Test that functions with attribute Cold are not inlined while the 3; same function without attribute Cold will be inlined.4 5; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S -inline-threshold=600 | FileCheck %s -check-prefix=OVERRIDE6; The command line argument for inline-threshold should override7; the default cold threshold, so a cold function with size bigger8; than the default cold threshold (225) will be inlined.9 10; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S | FileCheck %s -check-prefix=DEFAULT11; The same cold function will not be inlined with the default behavior.12 13@a = global i32 414 15; This function should be larger than the cold threshold (75), but smaller16; than the regular threshold.17; Function Attrs: nounwind readnone uwtable18define i32 @simpleFunction(i32 %a) #0 "function-inline-cost"="80" {19entry:20 ret i32 %a21}22 23; Function Attrs: nounwind cold readnone uwtable24define i32 @ColdFunction(i32 %a) #1 "function-inline-cost"="30" {25; CHECK-LABEL: @ColdFunction26; CHECK: ret27; OVERRIDE-LABEL: @ColdFunction28; OVERRIDE: ret29; DEFAULT-LABEL: @ColdFunction30; DEFAULT: ret31entry:32 ret i32 %a33}34 35; This function should be larger than the default cold threshold (225).36define i32 @ColdFunction2(i32 %a) #1 "function-inline-cost"="250" {37; CHECK-LABEL: @ColdFunction238; CHECK: ret39; OVERRIDE-LABEL: @ColdFunction240; OVERRIDE: ret41; DEFAULT-LABEL: @ColdFunction242; DEFAULT: ret43entry:44 ret i32 %a45}46 47; Function Attrs: nounwind readnone uwtable48define i32 @bar(i32 %a) #0 {49; CHECK-LABEL: @bar50; CHECK: call i32 @ColdFunction(i32 5)51; CHECK-NOT: call i32 @simpleFunction(i32 6)52; CHECK: call i32 @ColdFunction2(i32 5)53; CHECK: ret54; OVERRIDE-LABEL: @bar55; OVERRIDE-NOT: call i32 @ColdFunction(i32 5)56; OVERRIDE-NOT: call i32 @simpleFunction(i32 6)57; OVERRIDE-NOT: call i32 @ColdFunction2(i32 5)58; OVERRIDE: ret59; DEFAULT-LABEL: @bar60; DEFAULT-NOT: call i32 @ColdFunction(i32 5)61; DEFAULT-NOT: call i32 @simpleFunction(i32 6)62; DEFAULT: call i32 @ColdFunction2(i32 5)63; DEFAULT: ret64entry:65 %0 = tail call i32 @ColdFunction(i32 5)66 %1 = tail call i32 @simpleFunction(i32 6)67 %2 = tail call i32 @ColdFunction2(i32 5)68 %3 = add i32 %0, %169 %add = add i32 %2, %370 ret i32 %add71}72 73declare void @extern()74attributes #0 = { nounwind readnone uwtable }75attributes #1 = { nounwind cold readnone uwtable }76