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