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
20 target datalayout = "e-m:e-i64:64-n32:64"
21 target triple = "powerpc64le-unknown-linux-gnu"
23 ; Function Attrs: nounwind
24 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 {
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
30 for.body.lr.ph: ; preds = %entry
31 %cmp1 = icmp sgt i32 %Arg, 10
34 for.cond.cleanup: ; preds = %for.inc, %entry
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, ptr %Ptr, align 4, !tbaa !33
40 %1 = add i32 %i.07, %0
41 store i32 %1, ptr %Ptr, align 4, !tbaa !33
42 br i1 %cmp1, label %if.then, label %for.inc, !prof !37
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
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
55 ; Function Attrs: nounwind
56 declare void @llvm.stackprotector(ptr, ptr) #1
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 }
61 !llvm.module.flags = !{!0, !1}
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"}
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}
109 exposesReturnsTwice: false
111 regBankSelected: false
114 tracksRegLiveness: true
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: '' }
135 - { reg: '$x3', virtual-reg: '%3' }
136 - { reg: '$x4', virtual-reg: '%4' }
137 - { reg: '$x5', virtual-reg: '%5' }
138 - { reg: '$x6', virtual-reg: '%6' }
140 isFrameAddressTaken: false
141 isReturnAddressTaken: false
150 maxCallFrameSize: 4294967295
151 cvBytesOfCalleeSavedRegisters: 0
152 hasOpaqueSPAdjustment: false
154 hasMustTailInVarArgFunc: false
161 machineFunctionInfo: {}
164 successors: %bb.1(0x7ecade30), %bb.2(0x013521d0)
165 liveins: $x3, $x4, $x5, $x6
167 %6:g8rc_and_g8rc_nox0 = COPY $x6
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
179 successors: %bb.3(0x80000000)
181 INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2, !31
182 %11:crrc = CMPWI %7, 10
183 %0:crbitrc = COPY %11.sub_gt
187 bb.2.for.cond.cleanup:
188 BLR8 implicit $lr8, implicit $rm
191 successors: %bb.4(0x00000002), %bb.5(0x7ffffffe)
193 %1:gprc_and_gprc_nor0 = PHI %10, %bb.1, %2, %bb.5
194 %12:gprc = LWZ 0, %6 :: (load (s32) from %ir.Ptr, !tbaa !33)
195 %13:gprc = ADD4 %1, killed %12
196 STW killed %13, 0, %6 :: (store (s32) into %ir.Ptr, !tbaa !33)
201 successors: %bb.5(0x80000000)
203 INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2, !31
204 ADJCALLSTACKDOWN 32, 0, implicit-def dead $r1, implicit $r1
206 STD %14, 24, $x1 :: (store (s64) into stack + 24)
207 %15:g8rc = EXTSW_32_64 %7
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
215 successors: %bb.2(0x013521d0), %bb.3(0x7ecade30)
217 %2:gprc = nuw nsw ADDI %1, 1
218 %16:crrc = CMPLW %8, %2
219 BCC 76, killed %16, %bb.2
224 # CHECK for enabling instruction hoisting
226 #CHECK-HOIST: bb.1.for.body.lr.ph:
227 #CHECK-HOIST: %14:g8rc = COPY $x2
228 #CHECK-HOIST: STD %14, 24, $x1 :: (store (s64) into stack + 24)
229 #CHECK-HOIST: %15:g8rc = EXTSW_32_64 %7
230 #CHECK-HOIST: B %bb.3
232 #CHECK-HOIST: bb.4.if.then:
233 #CHECK-HOIST-NOT: %14:g8rc = COPY $x2
234 #CHECK-HOIST-NOT: STD %14, 24, $x1 :: (store (s64) into stack + 24)
235 #CHECK-HOIST-NOT: %15:g8rc = EXTSW_32_64 %7
236 #CHECK-HOIST: bb.5.for.inc:
238 # CHECK for disabling instruction hoisting due to block hotness
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 (s64) into stack + 24)
243 #CHECK-NO-HOIST-NOT: %15:g8rc = EXTSW_32_64 %7
244 #CHECK-NO-HOIST: B %bb.3
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 (s64) into stack + 24)
249 #CHECK-NO-HOIST: %15:g8rc = EXTSW_32_64 %7
250 #CHECK-NO-HOIST: bb.5.for.inc: