1; RUN: opt < %s -inline -S -inlinecold-threshold=25 -enable-new-pm=0 | FileCheck %s 2; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S -inlinecold-threshold=25 | FileCheck %s 3; Test that functions with attribute Cold are not inlined while the 4; same function without attribute Cold will be inlined. 5 6; RUN: opt < %s -inline -S -inline-threshold=600 -enable-new-pm=0 | FileCheck %s -check-prefix=OVERRIDE 7; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S -inline-threshold=600 -enable-new-pm=0 | FileCheck %s -check-prefix=OVERRIDE 8; The command line argument for inline-threshold should override 9; the default cold threshold, so a cold function with size bigger 10; than the default cold threshold (225) will be inlined. 11 12; RUN: opt < %s -inline -S -enable-new-pm=0 | FileCheck %s -check-prefix=DEFAULT 13; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S | FileCheck %s -check-prefix=DEFAULT 14; The same cold function will not be inlined with the default behavior. 15 16@a = global i32 4 17 18; This function should be larger than the cold threshold (75), but smaller 19; than the regular threshold. 20; Function Attrs: nounwind readnone uwtable 21define i32 @simpleFunction(i32 %a) #0 "function-inline-cost"="80" { 22entry: 23 ret i32 %a 24} 25 26; Function Attrs: nounwind cold readnone uwtable 27define i32 @ColdFunction(i32 %a) #1 "function-inline-cost"="30" { 28; CHECK-LABEL: @ColdFunction 29; CHECK: ret 30; OVERRIDE-LABEL: @ColdFunction 31; OVERRIDE: ret 32; DEFAULT-LABEL: @ColdFunction 33; DEFAULT: ret 34entry: 35 ret i32 %a 36} 37 38; This function should be larger than the default cold threshold (225). 39define i32 @ColdFunction2(i32 %a) #1 "function-inline-cost"="250" { 40; CHECK-LABEL: @ColdFunction2 41; CHECK: ret 42; OVERRIDE-LABEL: @ColdFunction2 43; OVERRIDE: ret 44; DEFAULT-LABEL: @ColdFunction2 45; DEFAULT: ret 46entry: 47 ret i32 %a 48} 49 50; Function Attrs: nounwind readnone uwtable 51define i32 @bar(i32 %a) #0 { 52; CHECK-LABEL: @bar 53; CHECK: call i32 @ColdFunction(i32 5) 54; CHECK-NOT: call i32 @simpleFunction(i32 6) 55; CHECK: call i32 @ColdFunction2(i32 5) 56; CHECK: ret 57; OVERRIDE-LABEL: @bar 58; OVERRIDE-NOT: call i32 @ColdFunction(i32 5) 59; OVERRIDE-NOT: call i32 @simpleFunction(i32 6) 60; OVERRIDE-NOT: call i32 @ColdFunction2(i32 5) 61; OVERRIDE: ret 62; DEFAULT-LABEL: @bar 63; DEFAULT-NOT: call i32 @ColdFunction(i32 5) 64; DEFAULT-NOT: call i32 @simpleFunction(i32 6) 65; DEFAULT: call i32 @ColdFunction2(i32 5) 66; DEFAULT: ret 67entry: 68 %0 = tail call i32 @ColdFunction(i32 5) 69 %1 = tail call i32 @simpleFunction(i32 6) 70 %2 = tail call i32 @ColdFunction2(i32 5) 71 %3 = add i32 %0, %1 72 %add = add i32 %2, %3 73 ret i32 %add 74} 75 76declare void @extern() 77attributes #0 = { nounwind readnone uwtable } 78attributes #1 = { nounwind cold readnone uwtable } 79