Skip to content

Commit 71b001e

Browse files
authored
[MachinePipeliner] Add test missed in #154940 (NFC) (#163350)
This PR adds a testcase where pipeliner bails out early because the number of the store instructions exceeds the threshold set by `pipeliner-max-num-stores`. The test should have been added in #154940, but it was missed.
1 parent a42546e commit 71b001e

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# RUN: llc -run-pass pipeliner -debug-only=pipeliner %s -o /dev/null -pipeliner-max-num-stores=5 2>&1 | FileCheck %s
2+
# REQUIRES: asserts
3+
4+
# This loop has six stores, which exceeds the limit set by
5+
# `pipeliner-max-num-stores`.
6+
7+
# CHECK: Too many stores
8+
9+
--- |
10+
target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
11+
target triple = "hexagon-unknown-linux-musl"
12+
13+
define void @f(ptr %a, i32 %n) #0 {
14+
entry:
15+
%guard = icmp sgt i32 %n, 0
16+
%btc = sub nsw i32 %n, 1
17+
br i1 %guard, label %loop.preheader, label %exit
18+
19+
loop.preheader: ; preds = %entry
20+
%0 = add i32 %n, 1
21+
%cgep = getelementptr i8, ptr %a, i32 %0
22+
br label %loop
23+
24+
loop: ; preds = %loop.preheader, %loop
25+
%lsr.iv = phi ptr [ %cgep, %loop.preheader ], [ %cgep8, %loop ]
26+
%i = phi i32 [ %i.dec, %loop ], [ %btc, %loop.preheader ]
27+
%cgep7 = getelementptr i8, ptr %lsr.iv, i32 -2
28+
store i8 0, ptr %cgep7, align 1
29+
%cgep8 = getelementptr i8, ptr %lsr.iv, i32 -1
30+
store i8 1, ptr %cgep8, align 1
31+
store i8 2, ptr %lsr.iv, align 1
32+
%cgep9 = getelementptr i8, ptr %lsr.iv, i32 1
33+
store i8 3, ptr %cgep9, align 1
34+
%cgep10 = getelementptr i8, ptr %lsr.iv, i32 2
35+
store i8 4, ptr %cgep10, align 1
36+
%cgep11 = getelementptr i8, ptr %lsr.iv, i32 3
37+
store i8 5, ptr %cgep11, align 1
38+
%i.dec = sub i32 %i, 1
39+
%ec = icmp eq i32 %i.dec, 0
40+
br i1 %ec, label %exit, label %loop
41+
42+
exit: ; preds = %loop, %entry
43+
ret void
44+
}
45+
46+
attributes #0 = { "target-cpu"="hexagonv79" }
47+
...
48+
---
49+
name: f
50+
tracksRegLiveness: true
51+
body: |
52+
bb.0.entry:
53+
successors: %bb.1(0x50000000), %bb.3(0x30000000)
54+
liveins: $r0, $r1
55+
56+
%7:intregs = COPY $r1
57+
%6:intregs = COPY $r0
58+
%8:predregs = C2_cmpgti %7, 0
59+
J2_jumpf %8, %bb.3, implicit-def dead $pc
60+
J2_jump %bb.1, implicit-def dead $pc
61+
62+
bb.1.loop.preheader:
63+
successors: %bb.2(0x80000000)
64+
65+
%0:intregs = A2_addi %7, -1
66+
%1:intregs = S4_addaddi %7, %6, 1
67+
%10:intregs = A2_tfrsi 0
68+
%11:intregs = A2_tfrsi 1
69+
%14:intregs = COPY %0
70+
J2_loop0r %bb.2, %14, implicit-def $lc0, implicit-def $sa0, implicit-def $usr
71+
72+
bb.2.loop (machine-block-address-taken):
73+
successors: %bb.3(0x04000000), %bb.2(0x7c000000)
74+
75+
%2:intregs = PHI %1, %bb.1, %4, %bb.2
76+
S2_storerb_io %2, -2, %10 :: (store (s8) into %ir.cgep7)
77+
%4:intregs = A2_addi %2, -1
78+
S2_storerb_io %2, -1, %11 :: (store (s8) into %ir.cgep8)
79+
S4_storeirb_io %2, 0, 2 :: (store (s8) into %ir.lsr.iv)
80+
S4_storeirb_io %2, 1, 3 :: (store (s8) into %ir.cgep9)
81+
S4_storeirb_io %2, 2, 4 :: (store (s8) into %ir.cgep10)
82+
S4_storeirb_io %2, 3, 5 :: (store (s8) into %ir.cgep11)
83+
ENDLOOP0 %bb.2, implicit-def $pc, implicit-def $lc0, implicit $sa0, implicit $lc0
84+
J2_jump %bb.3, implicit-def dead $pc
85+
86+
bb.3.exit:
87+
PS_jmpret $r31, implicit-def dead $pc
88+
...

0 commit comments

Comments
 (0)