1# NOTE: This test verifies disable/enable instruction hoisting to hot blocks 2# based on profile data 3# RUN: llc -run-pass early-machinelicm -verify-machineinstrs \ 4# RUN: -mtriple=powerpc64le-unknown-linux-gnu \ 5# RUN: -disable-hoisting-to-hotter-blocks=pgo \ 6# RUN: -block-freq-ratio-threshold=100 %s -o - | FileCheck %s \ 7# RUN: --check-prefix=CHECK-NO-HOIST 8# RUN: llc -run-pass early-machinelicm -verify-machineinstrs \ 9# RUN: -mtriple=powerpc64le-unknown-linux-gnu \ 10# RUN: -disable-hoisting-to-hotter-blocks=pgo \ 11# RUN: -block-freq-ratio-threshold=100000000 %s -o - | FileCheck %s \ 12# RUN: --check-prefix=CHECK-HOIST 13# RUN: llc -run-pass early-machinelicm -verify-machineinstrs \ 14# RUN: -mtriple=powerpc64le-unknown-linux-gnu \ 15# RUN: -disable-hoisting-to-hotter-blocks=none \ 16# RUN: -block-freq-ratio-threshold=100 %s -o - | FileCheck %s \ 17# RUN: --check-prefix=CHECK-HOIST 18 19--- | 20 target datalayout = "e-m:e-i64:64-n32:64" 21 target triple = "powerpc64le-unknown-linux-gnu" 22 23 ; Function Attrs: nounwind 24 define dso_local void @test(void (i32)* nocapture %fp, i32 signext %Arg, i32 signext %Len, i32* nocapture %Ptr) local_unnamed_addr #0 !prof !29 !section_prefix !30 { 25 entry: 26 tail call void asm sideeffect "#NOTHING", "~{r2}"() #1, !srcloc !31 27 %cmp6 = icmp sgt i32 %Len, 0 28 br i1 %cmp6, label %for.body.lr.ph, label %for.cond.cleanup, !prof !32 29 30 for.body.lr.ph: ; preds = %entry 31 %cmp1 = icmp sgt i32 %Arg, 10 32 br label %for.body 33 34 for.cond.cleanup: ; preds = %for.inc, %entry 35 ret void 36 37 for.body: ; preds = %for.inc, %for.body.lr.ph 38 %i.07 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ] 39 %0 = load i32, i32* %Ptr, align 4, !tbaa !33 40 %1 = add i32 %i.07, %0 41 store i32 %1, i32* %Ptr, align 4, !tbaa !33 42 br i1 %cmp1, label %if.then, label %for.inc, !prof !37 43 44 if.then: ; preds = %for.body 45 tail call void asm sideeffect "#NOTHING", "~{r2}"() #1, !srcloc !31 46 tail call void %fp(i32 signext %Arg) #1, !prof !38 47 br label %for.inc 48 49 for.inc: ; preds = %if.then, %for.body 50 %inc = add nuw nsw i32 %i.07, 1 51 %exitcond = icmp eq i32 %Len, %inc 52 br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !39 53 } 54 55 ; Function Attrs: nounwind 56 declare void @llvm.stackprotector(i8*, i8**) #1 57 58 attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="ppc64le" "target-features"="+altivec,+bpermd,+crypto,+direct-move,+extdiv,+htm,+power8-vector,+vsx,-power9-vector" "unsafe-fp-math"="false" "use-soft-float"="false" } 59 attributes #1 = { nounwind } 60 61 !llvm.module.flags = !{!0, !1} 62 !llvm.ident = !{!28} 63 64 !0 = !{i32 1, !"wchar_size", i32 4} 65 !1 = !{i32 1, !"ProfileSummary", !2} 66 !2 = !{!3, !4, !5, !6, !7, !8, !9, !10} 67 !3 = !{!"ProfileFormat", !"InstrProf"} 68 !4 = !{!"TotalCount", i64 25405000087} 69 !5 = !{!"MaxCount", i64 21000000020} 70 !6 = !{!"MaxInternalCount", i64 200000003} 71 !7 = !{!"MaxFunctionCount", i64 21000000020} 72 !8 = !{!"NumCounts", i64 15} 73 !9 = !{!"NumFunctions", i64 7} 74 !10 = !{!"DetailedSummary", !11} 75 !11 = !{!12, !13, !14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27} 76 !12 = !{i32 10000, i64 21000000020, i32 1} 77 !13 = !{i32 100000, i64 21000000020, i32 1} 78 !14 = !{i32 200000, i64 21000000020, i32 1} 79 !15 = !{i32 300000, i64 21000000020, i32 1} 80 !16 = !{i32 400000, i64 21000000020, i32 1} 81 !17 = !{i32 500000, i64 21000000020, i32 1} 82 !18 = !{i32 600000, i64 21000000020, i32 1} 83 !19 = !{i32 700000, i64 21000000020, i32 1} 84 !20 = !{i32 800000, i64 21000000020, i32 1} 85 !21 = !{i32 900000, i64 4203000000, i32 2} 86 !22 = !{i32 950000, i64 4203000000, i32 2} 87 !23 = !{i32 990000, i64 4203000000, i32 2} 88 !24 = !{i32 999000, i64 200000003, i32 3} 89 !25 = !{i32 999900, i64 200000003, i32 3} 90 !26 = !{i32 999990, i64 2000000, i32 4} 91 !27 = !{i32 999999, i64 2000000, i32 4} 92 !28 = !{!"clang version 9.0.0 (git@github.ibm.com:compiler/llvm-project.git 01fc2fc8e690ee427cab149cb0bfd63568bed89b)"} 93 !29 = !{!"function_entry_count", i64 200000003} 94 !30 = !{!"function_section_prefix", !".hot"} 95 !31 = !{i32 65} 96 !32 = !{!"branch_weights", i32 -94967292, i32 40000000} 97 !33 = !{!34, !34, i64 0} 98 !34 = !{!"int", !35, i64 0} 99 !35 = !{!"omnipotent char", !36, i64 0} 100 !36 = !{!"Simple C/C++ TBAA"} 101 !37 = !{!"branch_weights", i32 4, i32 -94967296} 102 !38 = !{!"VP", i32 0, i64 20, i64 -3706093650706652785, i64 20} 103 !39 = !{!"branch_weights", i32 40000000, i32 -94967292} 104 105... 106--- 107name: test 108alignment: 4 109exposesReturnsTwice: false 110legalized: false 111regBankSelected: false 112selected: false 113failedISel: false 114tracksRegLiveness: true 115hasWinCFI: false 116registers: 117 - { id: 0, class: crbitrc, preferred-register: '' } 118 - { id: 1, class: gprc_and_gprc_nor0, preferred-register: '' } 119 - { id: 2, class: gprc, preferred-register: '' } 120 - { id: 3, class: g8rc, preferred-register: '' } 121 - { id: 4, class: g8rc, preferred-register: '' } 122 - { id: 5, class: g8rc, preferred-register: '' } 123 - { id: 6, class: g8rc_and_g8rc_nox0, preferred-register: '' } 124 - { id: 7, class: gprc, preferred-register: '' } 125 - { id: 8, class: gprc, preferred-register: '' } 126 - { id: 9, class: crrc, preferred-register: '' } 127 - { id: 10, class: gprc, preferred-register: '' } 128 - { id: 11, class: crrc, preferred-register: '' } 129 - { id: 12, class: gprc, preferred-register: '' } 130 - { id: 13, class: gprc, preferred-register: '' } 131 - { id: 14, class: g8rc, preferred-register: '' } 132 - { id: 15, class: g8rc, preferred-register: '' } 133 - { id: 16, class: crrc, preferred-register: '' } 134liveins: 135 - { reg: '$x3', virtual-reg: '%3' } 136 - { reg: '$x4', virtual-reg: '%4' } 137 - { reg: '$x5', virtual-reg: '%5' } 138 - { reg: '$x6', virtual-reg: '%6' } 139frameInfo: 140 isFrameAddressTaken: false 141 isReturnAddressTaken: false 142 hasStackMap: false 143 hasPatchPoint: false 144 stackSize: 0 145 offsetAdjustment: 0 146 maxAlignment: 0 147 adjustsStack: false 148 hasCalls: true 149 stackProtector: '' 150 maxCallFrameSize: 4294967295 151 cvBytesOfCalleeSavedRegisters: 0 152 hasOpaqueSPAdjustment: false 153 hasVAStart: false 154 hasMustTailInVarArgFunc: false 155 localFrameSize: 0 156 savePoint: '' 157 restorePoint: '' 158fixedStack: [] 159stack: [] 160constants: [] 161machineFunctionInfo: {} 162body: | 163 bb.0.entry: 164 successors: %bb.1(0x7ecade30), %bb.2(0x013521d0) 165 liveins: $x3, $x4, $x5, $x6 166 167 %6:g8rc_and_g8rc_nox0 = COPY $x6 168 %5:g8rc = COPY $x5 169 %4:g8rc = COPY $x4 170 %3:g8rc = COPY $x3 171 %7:gprc = COPY %4.sub_32 172 %8:gprc = COPY %5.sub_32 173 INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2, !31 174 %9:crrc = CMPWI %8, 1 175 BCC 12, killed %9, %bb.2 176 B %bb.1 177 178 bb.1.for.body.lr.ph: 179 successors: %bb.3(0x80000000) 180 181 INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2, !31 182 %11:crrc = CMPWI %7, 10 183 %0:crbitrc = COPY %11.sub_gt 184 %10:gprc = LI 0 185 B %bb.3 186 187 bb.2.for.cond.cleanup: 188 BLR8 implicit $lr8, implicit $rm 189 190 bb.3.for.body: 191 successors: %bb.4(0x00000002), %bb.5(0x7ffffffe) 192 193 %1:gprc_and_gprc_nor0 = PHI %10, %bb.1, %2, %bb.5 194 %12:gprc = LWZ 0, %6 :: (load 4 from %ir.Ptr, !tbaa !33) 195 %13:gprc = ADD4 %1, killed %12 196 STW killed %13, 0, %6 :: (store 4 into %ir.Ptr, !tbaa !33) 197 BCn %0, %bb.5 198 B %bb.4 199 200 bb.4.if.then: 201 successors: %bb.5(0x80000000) 202 203 INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2, !31 204 ADJCALLSTACKDOWN 32, 0, implicit-def dead $r1, implicit $r1 205 %14:g8rc = COPY $x2 206 STD %14, 24, $x1 :: (store 8 into stack + 24) 207 %15:g8rc = EXTSW_32_64 %7 208 $x3 = COPY %15 209 $x12 = COPY %3 210 MTCTR8 %3, implicit-def $ctr8 211 BCTRL8_LDinto_toc 24, $x1, csr_ppc64_altivec, implicit-def dead $lr8, implicit-def dead $x2, implicit $ctr8, implicit $rm, implicit $x3, implicit $x12, implicit $x2, implicit-def $r1 212 ADJCALLSTACKUP 32, 0, implicit-def dead $r1, implicit $r1 213 214 bb.5.for.inc: 215 successors: %bb.2(0x013521d0), %bb.3(0x7ecade30) 216 217 %2:gprc = nuw nsw ADDI %1, 1 218 %16:crrc = CMPLW %8, %2 219 BCC 76, killed %16, %bb.2 220 B %bb.3 221 222... 223 224# CHECK for enabling instruction hoisting 225#CHECK-LABEL: test 226#CHECK-HOIST: bb.1.for.body.lr.ph: 227#CHECK-HOIST: %14:g8rc = COPY $x2 228#CHECK-HOIST: STD %14, 24, $x1 :: (store 8 into stack + 24) 229#CHECK-HOIST: %15:g8rc = EXTSW_32_64 %7 230#CHECK-HOIST: B %bb.3 231 232#CHECK-HOIST: bb.4.if.then: 233#CHECK-HOIST-NOT: %14:g8rc = COPY $x2 234#CHECK-HOIST-NOT: STD %14, 24, $x1 :: (store 8 into stack + 24) 235#CHECK-HOIST-NOT: %15:g8rc = EXTSW_32_64 %7 236#CHECK-HOIST: bb.5.for.inc: 237 238# CHECK for disabling instruction hoisting due to block hotness 239#CHECK-LABEL: test 240#CHECK-NO-HOIST: bb.1.for.body.lr.ph: 241#CHECK-NO-HOIST-NOT: %14:g8rc = COPY $x2 242#CHECK-NO-HOIST-NOT: STD %14, 24, $x1 :: (store 8 into stack + 24) 243#CHECK-NO-HOIST-NOT: %15:g8rc = EXTSW_32_64 %7 244#CHECK-NO-HOIST: B %bb.3 245 246#CHECK-NO-HOIST: bb.4.if.then: 247#CHECK-NO-HOIST: %14:g8rc = COPY $x2 248#CHECK-NO-HOIST: STD %14, 24, $x1 :: (store 8 into stack + 24) 249#CHECK-NO-HOIST: %15:g8rc = EXTSW_32_64 %7 250#CHECK-NO-HOIST: bb.5.for.inc: 251 252