122 lines · plain
1;; Check if basic blocks without unique sections are only placed in cold sections if it is safe2;; to do so.3;;4;; Profile for version 0.5; RUN: echo 'v1' > %t16; RUN: echo 'f _Z3asm_goto' >> %t17; RUN: echo 'c 0' >> %t18; RUN: echo 'f _Z3jump_table' >> %t19; RUN: echo 'c 0' >> %t110; RUN: echo 'f _Z3red_zone' >> %t111; RUN: echo 'c 0' >> %t112;;13; RUN: llc < %s -mtriple=aarch64 -function-sections -basic-block-sections=%t1 -unique-basic-block-section-names -bbsections-cold-text-prefix=".text.unlikely." | FileCheck %s14; RUN: llc < %s -mtriple=aarch64 -function-sections -aarch64-min-jump-table-entries=4 -basic-block-sections=%t1 -unique-basic-block-section-names -bbsections-cold-text-prefix=".text.unlikely." | FileCheck %s -check-prefix=JUMP-TABLES15; RUN: llc < %s -mtriple=aarch64 -function-sections -basic-block-sections=%t1 -unique-basic-block-section-names -bbsections-cold-text-prefix=".text.unlikely." | FileCheck %s -check-prefix=RED-ZONE16 17define void @_Z3asm_goto(i1 zeroext %0, i1 zeroext %1) nounwind {18 ;; Check that blocks containing or targeted by asm goto aren't split.19 ; CHECK-LABEL: _Z3asm_goto20 ; CHECK: .section .text.unlikely._Z3asm_goto,"ax",@progbits21 ; CHECK-NEXT: _Z3asm_goto.cold:22 ; CHECK-NEXT: bl bam23 ; CHECK: .LBB0_4:24 ; CHECK: ret25 ; CHECK: .LBB_END0_4:26 27 br i1 %0, label %3, label %528 293: ; preds = %230 %4 = call i32 @bar()31 callbr void asm sideeffect "nop", "!i"() #332 to label %asm.fallthrough [label %5]33 34 35asm.fallthrough: ; preds = %336 br label %537 385: ; preds = %2, %asm.fallthrough39 %6 = call i32 @bar()40 br i1 %1, label %7, label %941 427:43 %8 = call i32 @bam()44 br label %945 469: ; preds = %747 ret void48}49 50define i32 @_Z3jump_table(i32 %in) nounwind {51 ;; Check that a cold block that contains a jump table dispatch or52 ;; that is targeted by a jump table is not split.53 ; JUMP-TABLES-LABEL: _Z3jump_table54 ; JUMP-TABLES: .section .text.unlikely._Z3jump_table,"ax",@progbits55 ; JUMP-TABLES-NEXT: _Z3jump_table.cold:56 ; JUMP-TABLES-SAME: %common.ret57 ; JUMP-TABLES-NOT: b bar58 ; JUMP-TABLES-NOT: b baz59 ; JUMP-TABLES-NOT: b qux60 ; JUMP-TABLES-NOT: b bam61 62 switch i32 %in, label %common.ret [63 i32 0, label %cold164 i32 1, label %cold265 i32 2, label %cold366 i32 3, label %cold467 ]68 69 common.ret: ; preds = %070 ret i32 071 72 cold1: ; preds = %073 %1 = tail call i32 @bar()74 ret i32 %175 76 cold2: ; preds = %077 %2 = tail call i32 @baz()78 ret i32 %279 80 cold3: ; preds = %081 %3 = tail call i32 @bam()82 ret i32 %383 84 cold4: ; preds = %085 %4 = tail call i32 @qux()86 ret i32 %487}88 89define i32 @_Z3red_zone(i1 zeroext %0, i32 %a, i32 %b) nounwind {90;; Check that cold blocks in functions with red zones aren't split.91; RED-ZONE-LABEL: _Z3red_zone92; MFS-REDZONE-AARCH64-NOT: _Z3red_zone.cold:93 %a.addr = alloca i32, align 494 %b.addr = alloca i32, align 495 %x = alloca i32, align 496 97 br i1 %0, label %2, label %398 992: ; preds = %1100 store i32 %a, ptr %a.addr, align 4101 store i32 %b, ptr %b.addr, align 4102 br label %4103 1043: ; preds = %1105 store i32 %a, ptr %b.addr, align 4106 store i32 %b, ptr %a.addr, align 4107 br label %4108 1094: ; preds = %3, %2110 %tmp = load i32, ptr %a.addr, align 4111 %tmp1 = load i32, ptr %b.addr, align 4112 %add = add nsw i32 %tmp, %tmp1113 store i32 %add, ptr %x, align 4114 %tmp2 = load i32, ptr %x, align 4115 ret i32 %tmp2116}117 118declare i32 @bar()119declare i32 @baz()120declare i32 @bam()121declare i32 @qux()122