| 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 |
| 34 |
--- | |
| 35 |
target datalayout = "e-m:e-i64:64-n32:64" |
| 36 |
target triple = "powerpc64le-unknown-linux-gnu" |
| 37 |
|
| 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 { |
| 40 |
entry: |
| 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 |
| 44 |
|
| 45 |
for.body.lr.ph: ; preds = %entry |
| 46 |
%cmp1 = icmp sgt i32 %Arg, 10 |
| 47 |
br label %for.body |
| 48 |
|
| 49 |
for.cond.cleanup: ; preds = %for.inc, %entry |
| 50 |
ret void |
| 51 |
|
| 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 |
| 58 |
|
| 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 |
| 62 |
br label %for.inc |
| 63 |
|
| 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 |
| 68 |
} |
| 69 |
|
| 70 |
; Function Attrs: nounwind |
| 71 |
declare void @llvm.stackprotector(ptr, ptr) #1 |
| 72 |
|
| 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" "use-soft-float"="false" } |
| 74 |
attributes #1 = { nounwind } |
| 75 |
|
| 76 |
!llvm.module.flags = !{!0, !1} |
| 77 |
!llvm.ident = !{!28} |
| 78 |
|
| 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 ([email protected]:compiler/llvm-project.git 01fc2fc8e690ee427cab149cb0bfd63568bed89b)"} |
| 108 |
!29 = !{!"function_entry_count", i64 200000003} |
| 109 |
!30 = !{!"function_section_prefix", !".hot"} |
| 110 |
!31 = !{i32 65} |
| 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} |
| 119 |
|
| 120 |
... |
| 121 |
--- |
| 122 |
name: test |
| 123 |
alignment: 4 |
| 124 |
exposesReturnsTwice: false |
| 125 |
legalized: false |
| 126 |
regBankSelected: false |
| 127 |
selected: false |
| 128 |
failedISel: false |
| 129 |
tracksRegLiveness: true |
| 130 |
hasWinCFI: false |
| 131 |
registers: |
| 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: '' } |
| 149 |
liveins: |
| 150 |
- { reg: '$x3', virtual-reg: '%3' } |
| 151 |
- { reg: '$x4', virtual-reg: '%4' } |
| 152 |
- { reg: '$x5', virtual-reg: '%5' } |
| 153 |
- { reg: '$x6', virtual-reg: '%6' } |
| 154 |
frameInfo: |
| 155 |
isFrameAddressTaken: false |
| 156 |
isReturnAddressTaken: false |
| 157 |
hasStackMap: false |
| 158 |
hasPatchPoint: false |
| 159 |
stackSize: 0 |
| 160 |
offsetAdjustment: 0 |
| 161 |
maxAlignment: 0 |
| 162 |
adjustsStack: false |
| 163 |
hasCalls: true |
| 164 |
stackProtector: '' |
| 165 |
maxCallFrameSize: 4294967295 |
| 166 |
cvBytesOfCalleeSavedRegisters: 0 |
| 167 |
hasOpaqueSPAdjustment: false |
| 168 |
hasVAStart: false |
| 169 |
hasMustTailInVarArgFunc: false |
| 170 |
localFrameSize: 0 |
| 171 |
savePoint: [] |
| 172 |
restorePoint: [] |
| 173 |
fixedStack: [] |
| 174 |
stack: [] |
| 175 |
constants: [] |
| 176 |
machineFunctionInfo: {} |
| 177 |
body: | |
| 178 |
bb.0.entry: |
| 179 |
successors: %bb.1(0x7ecade30), %bb.2(0x013521d0) |
| 180 |
liveins: $x3, $x4, $x5, $x6 |
| 181 |
|
| 182 |
%6:g8rc_and_g8rc_nox0 = COPY $x6 |
| 183 |
%5:g8rc = COPY $x5 |
| 184 |
%4:g8rc = COPY $x4 |
| 185 |
%3:g8rc = COPY $x3 |
| 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 |
| 191 |
B %bb.1 |
| 192 |
|
| 193 |
bb.1.for.body.lr.ph: |
| 194 |
successors: %bb.3(0x80000000) |
| 195 |
|
| 196 |
INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2, !31 |
| 197 |
%11:crrc = CMPWI %7, 10 |
| 198 |
%0:crbitrc = COPY %11.sub_gt |
| 199 |
%10:gprc = LI 0 |
| 200 |
B %bb.3 |
| 201 |
|
| 202 |
bb.2.for.cond.cleanup: |
| 203 |
BLR8 implicit $lr8, implicit $rm |
| 204 |
|
| 205 |
bb.3.for.body: |
| 206 |
successors: %bb.4(0x00000002), %bb.5(0x7ffffffe) |
| 207 |
|
| 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) |
| 212 |
BCn %0, %bb.5 |
| 213 |
B %bb.4 |
| 214 |
|
| 215 |
bb.4.if.then: |
| 216 |
successors: %bb.5(0x80000000) |
| 217 |
|
| 218 |
INLINEASM &"#NOTHING", 1, 12, implicit-def early-clobber $r2, !31 |
| 219 |
ADJCALLSTACKDOWN 32, 0, implicit-def dead $r1, implicit $r1 |
| 220 |
%14:g8rc = COPY $x2 |
| 221 |
STD %14, 24, $x1 :: (store (s64) into stack + 24) |
| 222 |
%15:g8rc = EXTSW_32_64 %7 |
| 223 |
$x3 = COPY %15 |
| 224 |
$x12 = COPY %3 |
| 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 |
| 228 |
|
| 229 |
bb.5.for.inc: |
| 230 |
successors: %bb.2(0x013521d0), %bb.3(0x7ecade30) |
| 231 |
|
| 232 |
%2:gprc = nuw nsw ADDI %1, 1 |
| 233 |
%16:crrc = CMPLW %8, %2 |
| 234 |
BCC 76, killed %16, %bb.2 |
| 235 |
B %bb.3 |
| 236 |
|
| 237 |
... |
| 238 |
|
| 239 |
# CHECK for enabling instruction hoisting |
| 240 |
#CHECK-LABEL: test |
| 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 |
| 246 |
|
| 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: |
| 252 |
|
| 253 |
# CHECK for disabling instruction hoisting due to block hotness |
| 254 |
#CHECK-LABEL: test |
| 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 |
| 260 |
|
| 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: |
| 266 |
|