brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · 691f3e7 Raw
188 lines · plain
1; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s2 3 4@gvar = external global i325 6; dupbb has two predecessors, p1 and p2. p1 is hot, p2 is cold. So dupbb7; should be placed after p1, and not duplicated into p2.8;9; CHECK-LABEL: test110; CHECK:       %p111; CHECK:       .LBB0_4: # %dupbb12; CHECK:       %p213; CHECK:       jmp .LBB0_414 15define void @test1(ptr %p) !prof !1 {16entry:17  br label %header18 19header:20  %call = call zeroext i1 @a()21  br i1 %call, label %p1, label %p2, !prof !222 23p1:24  call void @b()25  br label %dupbb26 27p2:28  call void @c()29  br label %dupbb30 31dupbb:32  %cond = icmp eq ptr @gvar, %p33  br i1 %cond, label %header, label %latch, !prof !334 35latch:36  %call3 = call zeroext i1 @a()37  br i1 %call3, label %header, label %end, !prof !238 39end:40  ret void41}42 43 44; dupbb has four predecessors p1, p2, p3 and p4. p1 and p2 are hot, p3 and  p445; are cold. So dupbb should be placed after p1, duplicated into p2. p3 and p446; should jump to dupbb.47;48; CHECK-LABEL: test249; CHECK:       %p150; CHECK:       .LBB1_8: # %dupbb51;52; CHECK:       %p253; CHECK:       callq c54; CHECK-NEXT:  cmpq55; CHECK-NEXT:  je56; CHECK-NEXT:  jmp57;58; CHECK:       %p359; CHECK:       jmp .LBB1_860; CHECK:       %p461; CHECK:       jmp .LBB1_862 63define void @test2(ptr %p) !prof !1 {64entry:65  br label %header66 67header:68  %call = call zeroext i1 @a()69  br i1 %call, label %bb1, label %bb2, !prof !270 71bb1:72  %call1 = call zeroext i1 @a()73  br i1 %call1, label %p1, label %p2, !prof !474 75bb2:76  %call2 = call zeroext i1 @a()77  br i1 %call2, label %p3, label %p4, !prof !478 79p1:80  call void @b()81  br label %dupbb82 83p2:84  call void @c()85  br label %dupbb86 87p3:88  call void @d()89  br label %dupbb90 91p4:92  call void @e()93  br label %dupbb94 95dupbb:96  %cond = icmp eq ptr @gvar, %p97  br i1 %cond, label %bb3, label %bb4, !prof !498 99bb3:100  call void @b()101  br label %bb4102 103bb4:104  %call4 = call zeroext i1 @a()105  br i1 %call4, label %header, label %latch, !prof !3106 107latch:108  %call3 = call zeroext i1 @a()109  br i1 %call3, label %header, label %end, !prof !2110 111end:112  ret void113}114 115 116; dupbb has three predecessors p1, p2 and p3. p3 has two successors, so dupbb117; can't be duplicated into p3, but it should not block it to be duplicated into118; other predecessors.119;120; CHECK-LABEL: test3121; CHECK:       %p1122; CHECK:       .LBB2_6: # %dupbb123;124; CHECK:       %p2125; CHECK:       callq c126; CHECK:       cmpq127; CHECK-NEXT:  je128; CHECK-NEXT:  jmp129;130; CHECK:       %p3131; CHECK:       jne .LBB2_6132 133define void @test3(ptr %p) !prof !1 {134entry:135  br label %header136 137header:138  %call = call zeroext i1 @a()139  br i1 %call, label %bb1, label %p3, !prof !2140 141bb1:142  %call1 = call zeroext i1 @a()143  br i1 %call1, label %p1, label %p2, !prof !4144 145p1:146  call void @b()147  br label %dupbb148 149p2:150  call void @c()151  br label %dupbb152 153p3:154  %call2 = call zeroext i1 @a()155  br i1 %call2, label %dupbb, label %bb4, !prof !4156 157dupbb:158  %cond = icmp eq ptr @gvar, %p159  br i1 %cond, label %bb3, label %bb4, !prof !4160 161bb3:162  call void @b()163  br label %bb4164 165bb4:166  %call4 = call zeroext i1 @a()167  br i1 %call4, label %header, label %latch, !prof !3168 169latch:170  %call3 = call zeroext i1 @a()171  br i1 %call3, label %header, label %end, !prof !2172 173end:174  ret void175}176 177declare zeroext i1 @a()178declare void @b()179declare void @c()180declare void @d()181declare void @e()182declare void @f()183 184!1 = !{!"function_entry_count", i64 1000}185!2 = !{!"branch_weights", i32 100, i32 1}186!3 = !{!"branch_weights", i32 1, i32 100}187!4 = !{!"branch_weights", i32 60, i32 40}188