1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2 ; RUN: llc -mtriple=riscv64 < %s | FileCheck %s
4 define i1 @sink_li(ptr %text, ptr %text.addr.0) nounwind {
5 ; CHECK-LABEL: sink_li:
6 ; CHECK: # %bb.0: # %entry
7 ; CHECK-NEXT: addi sp, sp, -32
8 ; CHECK-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
9 ; CHECK-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
10 ; CHECK-NEXT: sd s1, 8(sp) # 8-byte Folded Spill
11 ; CHECK-NEXT: sd s2, 0(sp) # 8-byte Folded Spill
12 ; CHECK-NEXT: mv s1, a1
13 ; CHECK-NEXT: mv s0, a0
14 ; CHECK-NEXT: call toupper
15 ; CHECK-NEXT: li a1, 0
16 ; CHECK-NEXT: beqz s0, .LBB0_26
17 ; CHECK-NEXT: # %bb.1: # %while.body.preheader
18 ; CHECK-NEXT: li a2, 1
19 ; CHECK-NEXT: li a3, 9
20 ; CHECK-NEXT: li a4, 32
21 ; CHECK-NEXT: .LBB0_2: # %while.body
22 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
23 ; CHECK-NEXT: bnez a2, .LBB0_4
24 ; CHECK-NEXT: # %bb.3: # %while.body
25 ; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1
26 ; CHECK-NEXT: bne a2, a3, .LBB0_16
27 ; CHECK-NEXT: .LBB0_4: # %while.body.1
28 ; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1
29 ; CHECK-NEXT: bnez a2, .LBB0_6
30 ; CHECK-NEXT: # %bb.5: # %while.body.1
31 ; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1
32 ; CHECK-NEXT: bne a2, a3, .LBB0_17
33 ; CHECK-NEXT: .LBB0_6: # %while.body.3
34 ; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1
35 ; CHECK-NEXT: bnez a2, .LBB0_8
36 ; CHECK-NEXT: # %bb.7: # %while.body.3
37 ; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1
38 ; CHECK-NEXT: bne a2, a4, .LBB0_19
39 ; CHECK-NEXT: .LBB0_8: # %while.body.4
40 ; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1
41 ; CHECK-NEXT: bnez a2, .LBB0_10
42 ; CHECK-NEXT: # %bb.9: # %while.body.4
43 ; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1
44 ; CHECK-NEXT: bne a2, a4, .LBB0_21
45 ; CHECK-NEXT: .LBB0_10: # %while.body.5
46 ; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1
47 ; CHECK-NEXT: bnez a2, .LBB0_12
48 ; CHECK-NEXT: # %bb.11: # %while.body.5
49 ; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1
50 ; CHECK-NEXT: bne a2, a3, .LBB0_23
51 ; CHECK-NEXT: .LBB0_12: # %while.body.6
52 ; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1
53 ; CHECK-NEXT: bnez a2, .LBB0_2
54 ; CHECK-NEXT: # %bb.13: # %while.body.6
55 ; CHECK-NEXT: # in Loop: Header=BB0_2 Depth=1
56 ; CHECK-NEXT: beq a2, a3, .LBB0_2
57 ; CHECK-NEXT: # %bb.14: # %while.body.6
58 ; CHECK-NEXT: beqz a2, .LBB0_24
59 ; CHECK-NEXT: # %bb.15: # %strdup.exit.split.loop.exit126
60 ; CHECK-NEXT: addi s0, s1, 7
61 ; CHECK-NEXT: j .LBB0_25
62 ; CHECK-NEXT: .LBB0_16: # %while.body
63 ; CHECK-NEXT: beqz a2, .LBB0_26
64 ; CHECK-NEXT: j .LBB0_18
65 ; CHECK-NEXT: .LBB0_17: # %while.body.1
66 ; CHECK-NEXT: beqz a2, .LBB0_24
67 ; CHECK-NEXT: .LBB0_18: # %strdup.exit.loopexit
68 ; CHECK-NEXT: li s0, 0
69 ; CHECK-NEXT: j .LBB0_25
70 ; CHECK-NEXT: .LBB0_19: # %while.body.3
71 ; CHECK-NEXT: beqz a2, .LBB0_24
72 ; CHECK-NEXT: # %bb.20: # %strdup.exit.split.loop.exit120
73 ; CHECK-NEXT: addi s0, s1, 4
74 ; CHECK-NEXT: j .LBB0_25
75 ; CHECK-NEXT: .LBB0_21: # %while.body.4
76 ; CHECK-NEXT: beqz a2, .LBB0_24
77 ; CHECK-NEXT: # %bb.22: # %strdup.exit.split.loop.exit122
78 ; CHECK-NEXT: addi s0, s1, 5
79 ; CHECK-NEXT: j .LBB0_25
80 ; CHECK-NEXT: .LBB0_23: # %while.body.5
81 ; CHECK-NEXT: bnez a2, .LBB0_25
82 ; CHECK-NEXT: .LBB0_24:
83 ; CHECK-NEXT: li a1, 0
84 ; CHECK-NEXT: j .LBB0_26
85 ; CHECK-NEXT: .LBB0_25: # %strdup.exit
86 ; CHECK-NEXT: li s1, 0
87 ; CHECK-NEXT: mv s2, a0
88 ; CHECK-NEXT: li a0, 0
89 ; CHECK-NEXT: mv a1, s0
91 ; CHECK-NEXT: li a0, 0
92 ; CHECK-NEXT: mv a1, s2
93 ; CHECK-NEXT: li a2, 0
95 ; CHECK-NEXT: li a1, 1
96 ; CHECK-NEXT: .LBB0_26: # %return
97 ; CHECK-NEXT: mv a0, a1
98 ; CHECK-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
99 ; CHECK-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
100 ; CHECK-NEXT: ld s1, 8(sp) # 8-byte Folded Reload
101 ; CHECK-NEXT: ld s2, 0(sp) # 8-byte Folded Reload
102 ; CHECK-NEXT: addi sp, sp, 32
105 %call = call i32 @toupper()
106 %tobool.not = icmp eq ptr %text, null
107 br i1 %tobool.not, label %return, label %while.body
109 while.body: ; preds = %while.body.6, %while.body.6, %entry
110 switch i8 1, label %strdup.exit.split.loop.exit114 [
111 i8 1, label %while.body.1
112 i8 9, label %while.body.1
116 while.body.1: ; preds = %while.body, %while.body
117 switch i8 1, label %strdup.exit [
118 i8 1, label %while.body.3
119 i8 9, label %while.body.3
123 while.body.3: ; preds = %while.body.1, %while.body.1
124 switch i8 1, label %strdup.exit.split.loop.exit120 [
125 i8 32, label %while.body.4
126 i8 1, label %while.body.4
130 while.body.4: ; preds = %while.body.3, %while.body.3
131 switch i8 1, label %strdup.exit.split.loop.exit122 [
132 i8 32, label %while.body.5
133 i8 1, label %while.body.5
137 while.body.5: ; preds = %while.body.4, %while.body.4
138 switch i8 1, label %strdup.exit.split.loop.exit124 [
139 i8 1, label %while.body.6
140 i8 9, label %while.body.6
144 while.body.6: ; preds = %while.body.5, %while.body.5
145 switch i8 1, label %strdup.exit.split.loop.exit126 [
146 i8 1, label %while.body
147 i8 9, label %while.body
151 strdup.exit.split.loop.exit114: ; preds = %while.body
152 br label %strdup.exit
154 strdup.exit.split.loop.exit120: ; preds = %while.body.3
155 %incdec.ptr.3.le = getelementptr i8, ptr %text.addr.0, i64 4
156 br label %strdup.exit
158 strdup.exit.split.loop.exit122: ; preds = %while.body.4
159 %incdec.ptr.4.le = getelementptr i8, ptr %text.addr.0, i64 5
160 br label %strdup.exit
162 strdup.exit.split.loop.exit124: ; preds = %while.body.5
163 br label %strdup.exit
165 strdup.exit.split.loop.exit126: ; preds = %while.body.6
166 %incdec.ptr.6.le = getelementptr i8, ptr %text.addr.0, i64 7
167 br label %strdup.exit
169 strdup.exit: ; preds = %strdup.exit.split.loop.exit126, %strdup.exit.split.loop.exit124, %strdup.exit.split.loop.exit122, %strdup.exit.split.loop.exit120, %strdup.exit.split.loop.exit114, %while.body.1
170 %text.addr.0.lcssa = phi ptr [ null, %strdup.exit.split.loop.exit114 ], [ %incdec.ptr.3.le, %strdup.exit.split.loop.exit120 ], [ %incdec.ptr.4.le, %strdup.exit.split.loop.exit122 ], [ %text, %strdup.exit.split.loop.exit124 ], [ %incdec.ptr.6.le, %strdup.exit.split.loop.exit126 ], [ null, %while.body.1 ]
171 %call5.i = tail call ptr null(ptr null, ptr %text.addr.0.lcssa)
172 %memchr64 = tail call ptr null(ptr null, i32 %call, i64 0)
175 return: ; preds = %strdup.exit, %while.body.6, %while.body.5, %while.body.4, %while.body.3, %while.body.1, %while.body, %entry
176 %retval.1 = phi i1 [ false, %entry ], [ true, %strdup.exit ], [ false, %while.body ], [ false, %while.body.1 ], [ false, %while.body.3 ], [ false, %while.body.4 ], [ false, %while.body.5 ], [ false, %while.body.6 ]
180 declare i32 @toupper()