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 # Tests for the new pass manager
19 # RUN: llc -passes early-machinelicm \
20 # RUN: -mtriple=powerpc64le-unknown-linux-gnu \
21 # RUN: -disable-hoisting-to-hotter-blocks=pgo \
22 # RUN: -block-freq-ratio-threshold=100 %s -o - | FileCheck %s \
23 # RUN: --check-prefix=CHECK-NO-HOIST
24 # RUN: llc -passes early-machinelicm \
25 # RUN: -mtriple=powerpc64le-unknown-linux-gnu \
26 # RUN: -disable-hoisting-to-hotter-blocks=pgo \
27 # RUN: -block-freq-ratio-threshold=100000000 %s -o - | FileCheck %s \
28 # RUN: --check-prefix=CHECK-HOIST
29 # RUN: llc -passes early-machinelicm \
30 # RUN: -mtriple=powerpc64le-unknown-linux-gnu \
31 # RUN: -disable-hoisting-to-hotter-blocks=none \
32 # RUN: -block-freq-ratio-threshold=100 %s -o - | FileCheck %s \
33 # RUN: --check-prefix=CHECK-HOIST
35 target datalayout = "e-m:e-i64:64-n32:64"
36 target triple = "powerpc64le-unknown-linux-gnu"
38 ; Function Attrs: nounwind
39 define dso_local void @test(ptr nocapture %fp, i32 signext %Arg, i32 signext %Len, ptr nocapture %Ptr) local_unnamed_addr #0 !prof !29 !section_prefix !30 {
41 tail call void asm sideeffect "#NOTHING", "~{r2}"() #1, !srcloc !31
42 %cmp6 = icmp sgt i32 %Len, 0
43 br i1 %cmp6, label %for.body.lr.ph, label %for.cond.cleanup, !prof !32
45 for.body.lr.ph: ; preds = %entry
46 %cmp1 = icmp sgt i32 %Arg, 10
49 for.cond.cleanup: ; preds = %for.inc, %entry
52 for.body: ; preds = %for.inc, %for.body.lr.ph
53 %i.07 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.inc ]
54 %0 = load i32, ptr %Ptr, align 4, !tbaa !33
55 %1 = add i32 %i.07, %0
56 store i32 %1, ptr %Ptr, align 4, !tbaa !33
57 br i1 %cmp1, label %if.then, label %for.inc, !prof !37
59 if.then: ; preds = %for.body
60 tail call void asm sideeffect "#NOTHING", "~{r2}"() #1, !srcloc !31
61 tail call void %fp(i32 signext %Arg) #1, !prof !38
64 for.inc: ; preds = %if.then, %for.body
65 %inc = add nuw nsw i32 %i.07, 1
66 %exitcond = icmp eq i32 %Len, %inc
67 br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !39
70 ; Function Attrs: nounwind
71 declare void @llvm.stackprotector(ptr, ptr) #1
73 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" }
74 attributes #1 = { nounwind }
76 !llvm.module.flags = !{!0, !1}
79 !0 = !{i32 1, !"wchar_size", i32 4}
80 !1 = !{i32 1, !"ProfileSummary", !2}
81 !2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
82 !3 = !{!"ProfileFormat", !"InstrProf"}
83 !4 = !{!"TotalCount", i64 25405000087}
84 !5 = !{!"MaxCount", i64 21000000020}
85 !6 = !{!"MaxInternalCount", i64 200000003}
86 !7 = !{!"MaxFunctionCount", i64 21000000020}
87 !8 = !{!"NumCounts", i64 15}
88 !9 = !{!"NumFunctions", i64 7}
89 !10 = !{!"DetailedSummary", !11}
90 !11 = !{!12, !13, !14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27}
91 !12 = !{i32 10000, i64 21000000020, i32 1}
92 !13 = !{i32 100000, i64 21000000020, i32 1}
93 !14 = !{i32 200000, i64 21000000020, i32 1}
94 !15 = !{i32 300000, i64 21000000020, i32 1}
95 !16 = !{i32 400000, i64 21000000020, i32 1}
96 !17 = !{i32 500000, i64 21000000020, i32 1}
97 !18 = !{i32 600000, i64 21000000020, i32 1}
98 !19 = !{i32 700000, i64 21000000020, i32 1}
99 !20 = !{i32 800000, i64 21000000020, i32 1}
100 !21 = !{i32 900000, i64 4203000000, i32 2}
101 !22 = !{i32 950000, i64 4203000000, i32 2}
102 !23 = !{i32 990000, i64 4203000000, i32 2}
103 !24 = !{i32 999000, i64 200000003, i32 3}
104 !25 = !{i32 999900, i64 200000003, i32 3}
105 !26 = !{i32 999990, i64 2000000, i32 4}
106 !27 = !{i32 999999, i64 2000000, i32 4}
107 !28 = !{!"clang version 9.0.0 (git@github.ibm.com:compiler/llvm-project.git 01fc2fc8e690ee427cab149cb0bfd63568bed89b)"}
108 !29 = !{!"function_entry_count", i64 200000003}
109 !30 = !{!"function_section_prefix", !".hot"}
111 !32 = !{!"branch_weights", i32 -94967292, i32 40000000}
112 !33 = !{!34, !34, i64 0}
113 !34 = !{!"int", !35, i64 0}
114 !35 = !{!"omnipotent char", !36, i64 0}
115 !36 = !{!"Simple C/C++ TBAA"}
116 !37 = !{!"branch_weights", i32 4, i32 -94967296}
117 !38 = !{!"VP", i32 0, i64 20, i64 -3706093650706652785, i64 20}
118 !39 = !{!"branch_weights", i32 40000000, i32 -94967292}
124 exposesReturnsTwice: false
126 regBankSelected: false
129 tracksRegLiveness: true
132 - { id: 0, class: crbitrc, preferred-register: '' }
133 - { id: 1, class: gprc_and_gprc_nor0, preferred-register: '' }
134 - { id: 2, class: gprc, preferred-register: '' }
135 - { id: 3, class: g8rc, preferred-register: '' }
136 - { id: 4, class: g8rc, preferred-register: '' }
137 - { id: 5, class: g8rc, preferred-register: '' }
138 - { id: 6, class: g8rc_and_g8rc_nox0, preferred-register: '' }
139 - { id: 7, class: gprc, preferred-register: '' }
140 - { id: 8, class: gprc, preferred-register: '' }
141 - { id: 9, class: crrc, preferred-register: '' }
142 - { id: 10, class: gprc, preferred-register: '' }
143 - { id: 11, class: crrc, preferred-register: '' }
144 - { id: 12, class: gprc, preferred-register: '' }
145 - { id: 13, class: gprc, preferred-register: '' }
146 - { id: 14, class: g8rc, preferred-register: '' }
147 - { id: 15, class: g8rc, preferred-register: '' }
148 - { id: 16, class: crrc, preferred-register: '' }
150 - { reg: '$x3', virtual-reg: '%3' }
151 - { reg: '$x4', virtual-reg: '%4' }
152 - { reg: '$x5', virtual-reg: '%5' }
153 - { reg: '$x6', virtual-reg: '%6' }
155 isFrameAddressTaken: false
156 isReturnAddressTaken: false
165 maxCallFrameSize: 4294967295
166 cvBytesOfCalleeSavedRegisters: 0
167 hasOpaqueSPAdjustment: false
169 hasMustTailInVarArgFunc: false
176 machineFunctionInfo: {}
179 successors: %bb.1(0x7ecade30), %bb.2(0x013521d0)
180 liveins: $x3, $x4, $x5, $x6
182 %6:g8rc_and_g8rc_nox0 = COPY $x6
186 %7:gprc = COPY %4.sub_32
187 %8:gprc = COPY %5.sub_32
188 INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2, !31
189 %9:crrc = CMPWI %8, 1
190 BCC 12, killed %9, %bb.2
194 successors: %bb.3(0x80000000)
196 INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2, !31
197 %11:crrc = CMPWI %7, 10
198 %0:crbitrc = COPY %11.sub_gt
202 bb.2.for.cond.cleanup:
203 BLR8 implicit $lr8, implicit $rm
206 successors: %bb.4(0x00000002), %bb.5(0x7ffffffe)
208 %1:gprc_and_gprc_nor0 = PHI %10, %bb.1, %2, %bb.5
209 %12:gprc = LWZ 0, %6 :: (load (s32) from %ir.Ptr, !tbaa !33)
210 %13:gprc = ADD4 %1, killed %12
211 STW killed %13, 0, %6 :: (store (s32) into %ir.Ptr, !tbaa !33)
216 successors: %bb.5(0x80000000)
218 INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2, !31
219 ADJCALLSTACKDOWN 32, 0, implicit-def dead $r1, implicit $r1
221 STD %14, 24, $x1 :: (store (s64) into stack + 24)
222 %15:g8rc = EXTSW_32_64 %7
225 MTCTR8 %3, implicit-def $ctr8
226 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
227 ADJCALLSTACKUP 32, 0, implicit-def dead $r1, implicit $r1
230 successors: %bb.2(0x013521d0), %bb.3(0x7ecade30)
232 %2:gprc = nuw nsw ADDI %1, 1
233 %16:crrc = CMPLW %8, %2
234 BCC 76, killed %16, %bb.2
239 # CHECK for enabling instruction hoisting
241 #CHECK-HOIST: bb.1.for.body.lr.ph:
242 #CHECK-HOIST: %14:g8rc = COPY $x2
243 #CHECK-HOIST: STD %14, 24, $x1 :: (store (s64) into stack + 24)
244 #CHECK-HOIST: %15:g8rc = EXTSW_32_64 %7
245 #CHECK-HOIST: B %bb.3
247 #CHECK-HOIST: bb.4.if.then:
248 #CHECK-HOIST-NOT: %14:g8rc = COPY $x2
249 #CHECK-HOIST-NOT: STD %14, 24, $x1 :: (store (s64) into stack + 24)
250 #CHECK-HOIST-NOT: %15:g8rc = EXTSW_32_64 %7
251 #CHECK-HOIST: bb.5.for.inc:
253 # CHECK for disabling instruction hoisting due to block hotness
255 #CHECK-NO-HOIST: bb.1.for.body.lr.ph:
256 #CHECK-NO-HOIST-NOT: %14:g8rc = COPY $x2
257 #CHECK-NO-HOIST-NOT: STD %14, 24, $x1 :: (store (s64) into stack + 24)
258 #CHECK-NO-HOIST-NOT: %15:g8rc = EXTSW_32_64 %7
259 #CHECK-NO-HOIST: B %bb.3
261 #CHECK-NO-HOIST: bb.4.if.then:
262 #CHECK-NO-HOIST: %14:g8rc = COPY $x2
263 #CHECK-NO-HOIST: STD %14, 24, $x1 :: (store (s64) into stack + 24)
264 #CHECK-NO-HOIST: %15:g8rc = EXTSW_32_64 %7
265 #CHECK-NO-HOIST: bb.5.for.inc: