brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · 4baa0b5 Raw
91 lines · plain
1; RUN: opt < %s -codegenprepare -S | FileCheck %s2; RUN: llc < %s | FileCheck --check-prefix=ASM1 %s3; RUN: llc < %s -function-sections | FileCheck --check-prefix=ASM2 %s4 5target triple = "x86_64-pc-linux-gnu"6 7; This tests that hot/cold functions get correct section prefix assigned8 9; CHECK: hot_func1{{.*}}!section_prefix ![[HOT_ID:[0-9]+]]10; ASM1: .section .text.hot.,"ax",@progbits11; ASM2: .section .text.hot.hot_func1,"ax",@progbits12; The entry is hot13define void @hot_func1() !prof !15 {14  ret void15}16 17; CHECK: hot_func2{{.*}}!section_prefix ![[HOT_ID:[0-9]+]]18; Entry is cold but inner block is hot19define void @hot_func2(i32 %n) !prof !16 {20entry:21  %n.addr = alloca i32, align 422  %i = alloca i32, align 423  store i32 %n, ptr %n.addr, align 424  store i32 0, ptr %i, align 425  br label %for.cond26 27for.cond:28  %0 = load i32, ptr %i, align 429  %1 = load i32, ptr %n.addr, align 430  %cmp = icmp slt i32 %0, %131  br i1 %cmp, label %for.body, label %for.end, !prof !1932 33for.body:34  %2 = load i32, ptr %i, align 435  %inc = add nsw i32 %2, 136  store i32 %inc, ptr %i, align 437  br label %for.cond38 39for.end:40  ret void41}42 43; For instrumentation based PGO, we should only look at block counts,44; not call site VP metadata (which can exist on value profiled memcpy,45; or possibly left behind after static analysis based devirtualization).46; CHECK: cold_func1{{.*}}!section_prefix ![[COLD_ID:[0-9]+]]47; ASM1: .section .text.unlikely.,"ax",@progbits48; ASM2: .section .text.unlikely.cold_func1,"ax",@progbits49define void @cold_func1() !prof !16 {50  call void @hot_func1(), !prof !1751  call void @hot_func1(), !prof !1752  ret void53}54 55; CHECK: cold_func2{{.*}}!section_prefix ![[COLD_ID]]56define void @cold_func2() !prof !16 {57  call void @hot_func1(), !prof !1758  call void @hot_func1(), !prof !1859  call void @hot_func1(), !prof !1860  ret void61}62 63; CHECK: cold_func3{{.*}}!section_prefix ![[COLD_ID]]64define void @cold_func3() !prof !16 {65  call void @hot_func1(), !prof !1866  ret void67}68 69; CHECK: ![[HOT_ID]] = !{!"section_prefix", !"hot"}70; CHECK: ![[COLD_ID]] = !{!"section_prefix", !"unlikely"}71!llvm.module.flags = !{!1}72!1 = !{i32 1, !"ProfileSummary", !2}73!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}74!3 = !{!"ProfileFormat", !"InstrProf"}75!4 = !{!"TotalCount", i64 10000}76!5 = !{!"MaxCount", i64 1000}77!6 = !{!"MaxInternalCount", i64 1}78!7 = !{!"MaxFunctionCount", i64 1000}79!8 = !{!"NumCounts", i64 3}80!9 = !{!"NumFunctions", i64 3}81!10 = !{!"DetailedSummary", !11}82!11 = !{!12, !13, !14}83!12 = !{i32 10000, i64 100, i32 1}84!13 = !{i32 999000, i64 100, i32 1}85!14 = !{i32 999999, i64 1, i32 2}86!15 = !{!"function_entry_count", i64 1000}87!16 = !{!"function_entry_count", i64 1}88!17 = !{!"branch_weights", i32 80}89!18 = !{!"branch_weights", i32 1}90!19 = !{!"branch_weights", i32 1000, i32 1}91