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