1# NOTE: This test verifies disable/enable instruction hoisting to hot blocks 2# based on non-profile data 3# RUN: llc -run-pass early-machinelicm -mtriple=powerpc64le-unknown-linux-gnu \ 4# RUN: -verify-machineinstrs -disable-hoisting-to-hotter-blocks=all \ 5# RUN: -block-freq-ratio-threshold=100 %s -o - | FileCheck %s \ 6# RUN: --check-prefix=CHECK-NO-HOIST 7# RUN: llc -run-pass early-machinelicm -mtriple=powerpc64le-unknown-linux-gnu \ 8# RUN: -verify-machineinstrs -disable-hoisting-to-hotter-blocks=all \ 9# RUN: -block-freq-ratio-threshold=100000000 %s -o - | FileCheck %s \ 10# RUN: --check-prefix=CHECK-HOIST 11# RUN: llc -run-pass early-machinelicm -mtriple=powerpc64le-unknown-linux-gnu \ 12# RUN: -verify-machineinstrs -disable-hoisting-to-hotter-blocks=pgo \ 13# RUN: -block-freq-ratio-threshold=100 %s -o - | FileCheck %s \ 14# RUN: --check-prefix=CHECK-HOIST 15# RUN: llc -run-pass early-machinelicm -mtriple=powerpc64le-unknown-linux-gnu \ 16# RUN: -verify-machineinstrs -disable-hoisting-to-hotter-blocks=none \ 17# RUN: -block-freq-ratio-threshold=100 %s -o - | FileCheck %s \ 18# RUN: --check-prefix=CHECK-HOIST 19 20--- | 21 target datalayout = "e-m:e-i64:64-n32:64" 22 23 define dso_local void @test(void (i32)* nocapture %fp, i32 signext %Arg, i32 signext %Len, i32* nocapture %Ptr) { 24 entry: 25 tail call void asm sideeffect "#NOTHING", "~{r2}"() 26 %cmp6 = icmp sgt i32 %Len, 0 27 br i1 %cmp6, label %for.body.lr.ph, label %for.cond.cleanup 28 29 for.body.lr.ph: ; preds = %entry 30 %cmp1 = icmp sgt i32 %Arg, 10 31 br label %for.body 32 33 for.cond.cleanup: ; preds = %for.inc, %entry 34 ret void 35 36 for.body: ; preds = %for.inc, %for.body.lr.ph 37 %i.07 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ] 38 %0 = load i32, i32* %Ptr, align 4 39 %1 = add i32 %i.07, %0 40 store i32 %1, i32* %Ptr, align 4 41 br i1 %cmp1, label %if.then, label %for.inc 42 43 if.then: ; preds = %for.body 44 tail call void asm sideeffect "#NOTHING", "~{r2}"() 45 tail call void %fp(i32 signext %Arg) 46 br label %for.inc 47 48 for.inc: ; preds = %if.then, %for.body 49 %inc = add nuw nsw i32 %i.07, 1 50 %exitcond = icmp eq i32 %Len, %inc 51 br i1 %exitcond, label %for.cond.cleanup, label %for.body 52 } 53 54 ; Function Attrs: nounwind 55 declare void @llvm.stackprotector(i8*, i8**) #0 56 57 attributes #0 = { nounwind } 58 59... 60--- 61name: test 62alignment: 4 63exposesReturnsTwice: false 64legalized: false 65regBankSelected: false 66selected: false 67failedISel: false 68tracksRegLiveness: true 69hasWinCFI: false 70registers: 71 - { id: 0, class: crbitrc, preferred-register: '' } 72 - { id: 1, class: gprc_and_gprc_nor0, preferred-register: '' } 73 - { id: 2, class: gprc, preferred-register: '' } 74 - { id: 3, class: g8rc, preferred-register: '' } 75 - { id: 4, class: g8rc, preferred-register: '' } 76 - { id: 5, class: g8rc, preferred-register: '' } 77 - { id: 6, class: g8rc_and_g8rc_nox0, preferred-register: '' } 78 - { id: 7, class: gprc, preferred-register: '' } 79 - { id: 8, class: gprc, preferred-register: '' } 80 - { id: 9, class: crrc, preferred-register: '' } 81 - { id: 10, class: gprc, preferred-register: '' } 82 - { id: 11, class: crrc, preferred-register: '' } 83 - { id: 12, class: gprc, preferred-register: '' } 84 - { id: 13, class: gprc, preferred-register: '' } 85 - { id: 14, class: g8rc, preferred-register: '' } 86 - { id: 15, class: g8rc, preferred-register: '' } 87 - { id: 16, class: crrc, preferred-register: '' } 88liveins: 89 - { reg: '$x3', virtual-reg: '%3' } 90 - { reg: '$x4', virtual-reg: '%4' } 91 - { reg: '$x5', virtual-reg: '%5' } 92 - { reg: '$x6', virtual-reg: '%6' } 93frameInfo: 94 isFrameAddressTaken: false 95 isReturnAddressTaken: false 96 hasStackMap: false 97 hasPatchPoint: false 98 stackSize: 0 99 offsetAdjustment: 0 100 maxAlignment: 0 101 adjustsStack: false 102 hasCalls: true 103 stackProtector: '' 104 maxCallFrameSize: 4294967295 105 cvBytesOfCalleeSavedRegisters: 0 106 hasOpaqueSPAdjustment: false 107 hasVAStart: false 108 hasMustTailInVarArgFunc: false 109 localFrameSize: 0 110 savePoint: '' 111 restorePoint: '' 112fixedStack: [] 113stack: [] 114constants: [] 115machineFunctionInfo: {} 116body: | 117 bb.0.entry: 118 successors: %bb.1(0x7ecade30), %bb.2(0x013521d0) 119 liveins: $x3, $x4, $x5, $x6 120 121 %6:g8rc_and_g8rc_nox0 = COPY $x6 122 %5:g8rc = COPY $x5 123 %4:g8rc = COPY $x4 124 %3:g8rc = COPY $x3 125 %7:gprc = COPY %4.sub_32 126 %8:gprc = COPY %5.sub_32 127 INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2 128 %9:crrc = CMPWI %8, 1 129 BCC 12, killed %9, %bb.2 130 B %bb.1 131 132 bb.1.for.body.lr.ph: 133 successors: %bb.3(0x80000000) 134 135 INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2 136 %11:crrc = CMPWI %7, 10 137 %0:crbitrc = COPY %11.sub_gt 138 %10:gprc = LI 0 139 B %bb.3 140 141 bb.2.for.cond.cleanup: 142 BLR8 implicit $lr8, implicit $rm 143 144 bb.3.for.body: 145 successors: %bb.4(0x00000002), %bb.5(0x7ffffffe) 146 147 %1:gprc_and_gprc_nor0 = PHI %10, %bb.1, %2, %bb.5 148 %12:gprc = LWZ 0, %6 :: (load 4 from %ir.Ptr) 149 %13:gprc = ADD4 %1, killed %12 150 STW killed %13, 0, %6 :: (store 4 into %ir.Ptr) 151 BCn %0, %bb.5 152 B %bb.4 153 154 bb.4.if.then: 155 successors: %bb.5(0x80000000) 156 157 INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2 158 ADJCALLSTACKDOWN 32, 0, implicit-def dead $r1, implicit $r1 159 %14:g8rc = COPY $x2 160 STD %14, 24, $x1 :: (store 8 into stack + 24) 161 %15:g8rc = EXTSW_32_64 %7 162 $x3 = COPY %15 163 $x12 = COPY %3 164 MTCTR8 %3, implicit-def $ctr8 165 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 166 ADJCALLSTACKUP 32, 0, implicit-def dead $r1, implicit $r1 167 168 bb.5.for.inc: 169 successors: %bb.2(0x013521d0), %bb.3(0x7ecade30) 170 171 %2:gprc = nuw nsw ADDI %1, 1 172 %16:crrc = CMPLW %8, %2 173 BCC 76, killed %16, %bb.2 174 B %bb.3 175 176... 177 178# CHECK for enabling instruction hoisting 179#CHECK-LABEL: test 180#CHECK-HOIST: bb.1.for.body.lr.ph: 181#CHECK-HOIST: %14:g8rc = COPY $x2 182#CHECK-HOIST: STD %14, 24, $x1 :: (store 8 into stack + 24) 183#CHECK-HOIST: %15:g8rc = EXTSW_32_64 %7 184#CHECK-HOIST: B %bb.3 185 186#CHECK-HOIST: bb.4.if.then: 187#CHECK-HOIST-NOT: %14:g8rc = COPY $x2 188#CHECK-HOIST-NOT: STD %14, 24, $x1 :: (store 8 into stack + 24) 189#CHECK-HOIST-NOT: %15:g8rc = EXTSW_32_64 %7 190#CHECK-HOIST: bb.5.for.inc: 191 192# CHECK for disabling instruction hoisting due to block hotness 193#CHECK-LABEL: test 194#CHECK-NO-HOIST: bb.1.for.body.lr.ph: 195#CHECK-NO-HOIST-NOT: %14:g8rc = COPY $x2 196#CHECK-NO-HOIST-NOT: STD %14, 24, $x1 :: (store 8 into stack + 24) 197#CHECK-NO-HOIST-NOT: %15:g8rc = EXTSW_32_64 %7 198#CHECK-NO-HOIST: B %bb.3 199 200#CHECK-NO-HOIST: bb.4.if.then: 201#CHECK-NO-HOIST: %14:g8rc = COPY $x2 202#CHECK-NO-HOIST: STD %14, 24, $x1 :: (store 8 into stack + 24) 203#CHECK-NO-HOIST: %15:g8rc = EXTSW_32_64 %7 204#CHECK-NO-HOIST: bb.5.for.inc: 205