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
21 target datalayout = "e-m:e-i64:64-n32:64"
23 define dso_local void @test(ptr nocapture %fp, i32 signext %Arg, i32 signext %Len, ptr nocapture %Ptr) {
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
29 for.body.lr.ph: ; preds = %entry
30 %cmp1 = icmp sgt i32 %Arg, 10
33 for.cond.cleanup: ; preds = %for.inc, %entry
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, ptr %Ptr, align 4
39 %1 = add i32 %i.07, %0
40 store i32 %1, ptr %Ptr, align 4
41 br i1 %cmp1, label %if.then, label %for.inc
43 if.then: ; preds = %for.body
44 tail call void asm sideeffect "#NOTHING", "~{r2}"()
45 tail call void %fp(i32 signext %Arg)
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
54 ; Function Attrs: nounwind
55 declare void @llvm.stackprotector(ptr, ptr) #0
57 attributes #0 = { nounwind }
63 exposesReturnsTwice: false
65 regBankSelected: false
68 tracksRegLiveness: true
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: '' }
89 - { reg: '$x3', virtual-reg: '%3' }
90 - { reg: '$x4', virtual-reg: '%4' }
91 - { reg: '$x5', virtual-reg: '%5' }
92 - { reg: '$x6', virtual-reg: '%6' }
94 isFrameAddressTaken: false
95 isReturnAddressTaken: false
104 maxCallFrameSize: 4294967295
105 cvBytesOfCalleeSavedRegisters: 0
106 hasOpaqueSPAdjustment: false
108 hasMustTailInVarArgFunc: false
115 machineFunctionInfo: {}
118 successors: %bb.1(0x7ecade30), %bb.2(0x013521d0)
119 liveins: $x3, $x4, $x5, $x6
121 %6:g8rc_and_g8rc_nox0 = COPY $x6
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
133 successors: %bb.3(0x80000000)
135 INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2
136 %11:crrc = CMPWI %7, 10
137 %0:crbitrc = COPY %11.sub_gt
141 bb.2.for.cond.cleanup:
142 BLR8 implicit $lr8, implicit $rm
145 successors: %bb.4(0x00000002), %bb.5(0x7ffffffe)
147 %1:gprc_and_gprc_nor0 = PHI %10, %bb.1, %2, %bb.5
148 %12:gprc = LWZ 0, %6 :: (load (s32) from %ir.Ptr)
149 %13:gprc = ADD4 %1, killed %12
150 STW killed %13, 0, %6 :: (store (s32) into %ir.Ptr)
155 successors: %bb.5(0x80000000)
157 INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2
158 ADJCALLSTACKDOWN 32, 0, implicit-def dead $r1, implicit $r1
160 STD %14, 24, $x1 :: (store (s64) into stack + 24)
161 %15:g8rc = EXTSW_32_64 %7
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
169 successors: %bb.2(0x013521d0), %bb.3(0x7ecade30)
171 %2:gprc = nuw nsw ADDI %1, 1
172 %16:crrc = CMPLW %8, %2
173 BCC 76, killed %16, %bb.2
178 # CHECK for enabling instruction hoisting
180 #CHECK-HOIST: bb.1.for.body.lr.ph:
181 #CHECK-HOIST: %14:g8rc = COPY $x2
182 #CHECK-HOIST: STD %14, 24, $x1 :: (store (s64) into stack + 24)
183 #CHECK-HOIST: %15:g8rc = EXTSW_32_64 %7
184 #CHECK-HOIST: B %bb.3
186 #CHECK-HOIST: bb.4.if.then:
187 #CHECK-HOIST-NOT: %14:g8rc = COPY $x2
188 #CHECK-HOIST-NOT: STD %14, 24, $x1 :: (store (s64) into stack + 24)
189 #CHECK-HOIST-NOT: %15:g8rc = EXTSW_32_64 %7
190 #CHECK-HOIST: bb.5.for.inc:
192 # CHECK for disabling instruction hoisting due to block hotness
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 (s64) into stack + 24)
197 #CHECK-NO-HOIST-NOT: %15:g8rc = EXTSW_32_64 %7
198 #CHECK-NO-HOIST: B %bb.3
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 (s64) into stack + 24)
203 #CHECK-NO-HOIST: %15:g8rc = EXTSW_32_64 %7
204 #CHECK-NO-HOIST: bb.5.for.inc: