• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16//! CHECKER       AOT IR Builder, check String concatenation loop
17//! SKIP_IF       @architecture == "arm32"
18//! RUN           entry: "ETSGLOBAL::main"
19//! RUN_PAOC      options: "--compiler-regex='.*concat_loop[0-9]*' --compiler-inlining=false"
20//!
21//! METHOD        "ETSGLOBAL::concat_loop0"
22//! PASS_BEFORE   "BranchElimination"
23//! IN_BLOCK      /loop/
24//! INST          /StringBuilder::<ctor>/
25//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
26//! INST          /Intrinsic.StdCoreSbToString/
27//! PASS_AFTER    "SimplifyStringBuilder"
28//! IN_BLOCK      /prehead/
29//! INST          /StringBuilder::<ctor>/
30//! INST          /Intrinsic.StdCoreSbAppendString/
31//! PASS_AFTER    "SimplifyStringBuilder"
32//! IN_BLOCK      /loop/
33//! INST          /Intrinsic.StdCoreSbAppendString/
34//! INST_NOT      /Intrinsic.StdCoreSbToString/
35//! PASS_AFTER    "SimplifyStringBuilder"
36//! INST          /Intrinsic.StdCoreSbToString/
37//!
38//! METHOD        "ETSGLOBAL::concat_loop1"
39//! PASS_BEFORE   "BranchElimination"
40//! IN_BLOCK      /loop/
41//! INST          /StringBuilder::<ctor>/
42//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
43//! INST          /Intrinsic.StdCoreSbToString/
44//! PASS_AFTER    "SimplifyStringBuilder"
45//! IN_BLOCK      /prehead/
46//! INST          /StringBuilder::<ctor>/
47//! INST          /Intrinsic.StdCoreSbAppendString/
48//! PASS_AFTER    "SimplifyStringBuilder"
49//! IN_BLOCK      /loop/
50//! INST          /Intrinsic.StdCoreSbAppendString/
51//! INST_NOT      /Intrinsic.StdCoreSbToString/
52//! PASS_AFTER    "SimplifyStringBuilder"
53//! INST          /Intrinsic.StdCoreSbToString/
54//!
55//! METHOD        "ETSGLOBAL::concat_loop2"
56//! PASS_BEFORE   "BranchElimination"
57//! IN_BLOCK      /head, loop/
58//! INST          /StringBuilder::<ctor>/
59//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
60//! INST          /Intrinsic.StdCoreSbToString/
61//! PASS_AFTER    "SimplifyStringBuilder"
62//! IN_BLOCK      /prehead/
63//! INST          /StringBuilder::<ctor>/
64//! INST          /Intrinsic.StdCoreSbAppendString/
65//! PASS_AFTER    "SimplifyStringBuilder"
66//! IN_BLOCK      /head, loop/
67//! INST          /Intrinsic.StdCoreSbAppendString/
68//! INST_NOT      /Intrinsic.StdCoreSbToString/
69//! PASS_AFTER    "SimplifyStringBuilder"
70//! INST          /Intrinsic.StdCoreSbToString/
71//!
72//! METHOD        "ETSGLOBAL::concat_loop3"
73//! PASS_BEFORE   "BranchElimination"
74//! IN_BLOCK      /loop/
75//! INST          /StringBuilder::<ctor>/
76//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
77//! INST          /Intrinsic.StdCoreSbToString/
78//! PASS_AFTER    "SimplifyStringBuilder"
79//! IN_BLOCK      /prehead/
80//! INST          /StringBuilder::<ctor>/
81//! INST          /Intrinsic.StdCoreSbAppendString/
82//! PASS_AFTER    "SimplifyStringBuilder"
83//! IN_BLOCK      /loop/
84//! INST          /Intrinsic.StdCoreSbAppendString/
85//! INST_NOT      /Intrinsic.StdCoreSbToString/
86//! PASS_AFTER    "SimplifyStringBuilder"
87//! INST          /Intrinsic.StdCoreSbToString/
88//!
89//! METHOD        "ETSGLOBAL::concat_loop4"
90//! PASS_BEFORE   "BranchElimination"
91//! IN_BLOCK      /loop/
92//! INST          /StringBuilder::<ctor>/
93//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
94//! INST          /Intrinsic.StdCoreSbToString/
95//! PASS_AFTER    "SimplifyStringBuilder"
96//! IN_BLOCK      /prehead/
97//! INST          /StringBuilder::<ctor>/
98//! INST          /Intrinsic.StdCoreSbAppendString/
99//! PASS_AFTER    "SimplifyStringBuilder"
100//! IN_BLOCK      /loop/
101//! INST          /Intrinsic.StdCoreSbAppendString/
102//! INST_NOT      /Intrinsic.StdCoreSbToString/
103//! PASS_AFTER    "SimplifyStringBuilder"
104//! INST          /Intrinsic.StdCoreSbToString/
105//!
106//! METHOD        "ETSGLOBAL::concat_loop5"
107//! PASS_BEFORE   "BranchElimination"
108//! IN_BLOCK      /loop/
109//! INST_COUNT    /StringBuilder::<ctor>/,2
110//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
111//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
112//! PASS_AFTER    "SimplifyStringBuilder"
113//! IN_BLOCK      /prehead/
114//! INST          /StringBuilder::<ctor>/
115//! INST          /Intrinsic.StdCoreSbAppendString/
116//! PASS_AFTER    "ChecksElimination"
117//! IN_BLOCK      /loop/
118//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
119//! INST_NOT      /Intrinsic.StdCoreSbToString/
120//! PASS_AFTER    "SimplifyStringBuilder"
121//! INST          /Intrinsic.StdCoreSbToString/
122//!
123//! METHOD        "ETSGLOBAL::concat_loop7"
124//! PASS_BEFORE   "BranchElimination"
125//! IN_BLOCK      /loop/
126//! INST_COUNT    /StringBuilder::<ctor>/,2
127//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
128//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
129//! PASS_AFTER    "ChecksElimination"
130//! IN_BLOCK      /prehead/
131//! INST_COUNT    /StringBuilder::<ctor>/,1
132//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,1
133//! PASS_AFTER    "ChecksElimination"
134//! IN_BLOCK      /loop/
135//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
136//! INST_NOT      /Intrinsic.StdCoreSbToString/
137//! PASS_AFTER    "ChecksElimination"
138//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
139//!
140//! METHOD        "ETSGLOBAL::equivalent_concat_loop7"
141//! PASS_BEFORE   "BranchElimination"
142//! IN_BLOCK      /loop/
143//! INST_COUNT    /StringBuilder::<ctor>/,2
144//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
145//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
146//! PASS_AFTER    "ChecksElimination"
147//! IN_BLOCK      /prehead/
148//! INST_COUNT    /StringBuilder::<ctor>/,1
149//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,1
150//! PASS_AFTER    "ChecksElimination"
151//! IN_BLOCK      /loop/
152//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
153//! INST_NOT      /Intrinsic.StdCoreSbToString/
154//! PASS_AFTER    "ChecksElimination"
155//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
156//!
157//! METHOD        "ETSGLOBAL::concat_loop8"
158//! PASS_BEFORE   "BranchElimination"
159//! IN_BLOCK      /loop/
160//! INST_COUNT    /StringBuilder::<ctor>/,6
161//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,10
162//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
163//! INST_COUNT    /Intrinsic.StdCoreSbToString/,6
164//! PASS_AFTER    "ChecksElimination"
165//! IN_BLOCK      /prehead/
166//! INST_COUNT    /StringBuilder::<ctor>/,2
167//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
168//! PASS_AFTER    "ChecksElimination"
169//! IN_BLOCK      /loop/
170//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
171//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
172//! INST_NOT      /Intrinsic.StdCoreSbToString/
173//! PASS_AFTER    "Codegen"
174//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
175//!
176//! METHOD        "ETSGLOBAL::nested_concat_loop0"
177//! PASS_BEFORE   "BranchElimination"
178//! IN_BLOCK      /loop 3/
179//! INST          /StringBuilder::<ctor>/
180//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
181//! INST          /Intrinsic.StdCoreSbToString/
182//! PASS_AFTER    "SimplifyStringBuilder"
183//! IN_BLOCK      /prehead/
184//! INST          /StringBuilder::<ctor>/
185//! INST          /Intrinsic.StdCoreSbAppendString/
186//! PASS_AFTER    "SimplifyStringBuilder"
187//! IN_BLOCK      /loop 3/
188//! INST          /Intrinsic.StdCoreSbAppendString/
189//! INST_NOT      /Intrinsic.StdCoreSbToString/
190//! PASS_AFTER    "SimplifyStringBuilder"
191//! IN_BLOCK      /loop 2/
192//! INST_NOT      /Intrinsic.StdCoreSbToString/
193//! PASS_AFTER    "SimplifyStringBuilder"
194//! IN_BLOCK      /loop 1/
195//! INST_NOT      /Intrinsic.StdCoreSbToString/
196//! PASS_AFTER    "SimplifyStringBuilder"
197//! INST          /Intrinsic.StdCoreSbToString/
198//!
199//! METHOD        "ETSGLOBAL::try_catch_concat_loop0"
200//! PASS_BEFORE   "BranchElimination"
201//! INST_COUNT    /StringBuilder::<ctor>/,6
202//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,14
203//! INST_COUNT    /Intrinsic.StdCoreSbToString/,6
204//! PASS_AFTER    "ChecksElimination"
205//! INST_NOT      /StringBuilder::<ctor>/
206//! INST_NOT      /Intrinsic.StdCoreSbAppendString/
207//! INST_NOT      /Intrinsic.StdCoreSbAppendInt/
208//! INST_NOT      /Intrinsic.StdCoreSbToString/
209//! INST_COUNT    /Intrinsic.StdCoreStringConcat2/,3
210//! INST_COUNT    /Intrinsic.StdCoreStringConcat4/,1
211//!
212//! METHOD        "ETSGLOBAL::try_catch_concat_loop1"
213//! PASS_BEFORE   "BranchElimination"
214//! INST_COUNT    /StringBuilder::<ctor>/,2
215//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
216//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
217//! PASS_AFTER    "ChecksElimination"
218//! INST_NOT      /StringBuilder::<ctor>/
219//! INST_NOT      /Intrinsic.StdCoreSbAppendString/
220//! INST_NOT      /Intrinsic.StdCoreSbAppendInt/
221//! INST_NOT      /Intrinsic.StdCoreSbToString/
222//! INST_COUNT    /Intrinsic.StdCoreStringConcat2/,1
223//!
224//! METHOD        "ETSGLOBAL::try_catch_concat_loop2"
225//! PASS_BEFORE   "BranchElimination"
226//! INST_COUNT    /StringBuilder::<ctor>/,3
227//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,6
228//! INST_COUNT    /Intrinsic.StdCoreSbToString/,3
229//! PASS_AFTER    "ChecksElimination"
230//! INST_COUNT    /StringBuilder::<ctor>/,1
231//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
232//! INST_NOT      /Intrinsic.StdCoreSbAppendInt/
233//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
234//!
235//! METHOD        "ETSGLOBAL::try_catch_concat_loop3"
236//! PASS_BEFORE   "BranchElimination"
237//! INST_COUNT    /StringBuilder::<ctor>/,2
238//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
239//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
240//! PASS_AFTER    "ChecksElimination"
241//! INST_NOT      /StringBuilder::<ctor>/
242//! INST_NOT      /Intrinsic.StdCoreSbAppendString/
243//! INST_NOT      /Intrinsic.StdCoreSbAppendInt/
244//! INST_NOT      /Intrinsic.StdCoreSbToString/
245//! INST_COUNT    /Intrinsic.StdCoreStringConcat2/,1
246//!
247//! METHOD        "ETSGLOBAL::try_catch_concat_loop4"
248//! PASS_BEFORE   "BranchElimination"
249//! INST_COUNT    /StringBuilder::<ctor>/,1
250//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
251//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
252//! PASS_AFTER    "ChecksElimination"
253//! INST_NOT      /StringBuilder::<ctor>/
254//! INST_NOT      /Intrinsic.StdCoreSbAppendString/
255//! INST_NOT      /Intrinsic.StdCoreSbAppendInt/
256//! INST_NOT      /Intrinsic.StdCoreSbToString/
257//! INST_COUNT    /Intrinsic.StdCoreStringConcat2/,1
258//!
259//! METHOD        "ETSGLOBAL::try_catch_concat_loop5"
260//! PASS_BEFORE   "BranchElimination"
261//! INST_COUNT    /StringBuilder::<ctor>/,5
262//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,10
263//! INST_COUNT    /Intrinsic.StdCoreSbToString/,5
264//! PASS_AFTER    "ChecksElimination"
265//! INST_COUNT    /StringBuilder::<ctor>/,1
266//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
267//! INST_COUNT    /Intrinsic.StdCoreSbAppendString /,1
268//! INST_COUNT    /Intrinsic.StdCoreStringConcat2/,1
269//!
270//! METHOD        "ETSGLOBAL::if_concat_loop0"
271//! PASS_BEFORE   "BranchElimination"
272//! INST_COUNT    /StringBuilder::<ctor>/,4
273//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,6
274//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
275//! INST_COUNT    /Intrinsic.StdCoreSbToString/,4
276//! PASS_AFTER    "ChecksElimination"
277//! INST_COUNT    /StringBuilder::<ctor>/,1
278//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
279//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
280//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
281//!
282//! METHOD        "ETSGLOBAL::if_concat_loop1"
283//! PASS_BEFORE   "BranchElimination"
284//! INST_COUNT    /StringBuilder::<ctor>/,3
285//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
286//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
287//! INST_COUNT    /Intrinsic.StdCoreSbToString/,3
288//! PASS_AFTER    "ChecksElimination"
289//! INST_COUNT    /StringBuilder::<ctor>/,1
290//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
291//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
292//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
293//!
294//! METHOD        "ETSGLOBAL::if_concat_loop2"
295//! PASS_BEFORE   "BranchElimination"
296//! INST_COUNT    /StringBuilder::<ctor>/,3
297//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,5
298//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
299//! INST_COUNT    /Intrinsic.StdCoreSbToString/,3
300//! PASS_AFTER    "ChecksElimination"
301//! INST_COUNT    /StringBuilder::<ctor>/,1
302//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
303//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
304//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
305//!
306//! METHOD        "ETSGLOBAL::if_concat_loop3"
307//! PASS_BEFORE   "BranchElimination"
308//! INST_COUNT    /StringBuilder::<ctor>/,3
309//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,5
310//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
311//! INST_COUNT    /Intrinsic.StdCoreSbToString/,3
312//! PASS_AFTER    "ChecksElimination"
313//! INST_COUNT    /StringBuilder::<ctor>/,1
314//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
315//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
316//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
317//!
318//! METHOD        "ETSGLOBAL::if_concat_loop4"
319//! PASS_BEFORE   "BranchElimination"
320//! INST_COUNT    /StringBuilder::<ctor>/,3
321//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
322//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
323//! INST_COUNT    /Intrinsic.StdCoreSbToString/,3
324//! PASS_AFTER    "ChecksElimination"
325//! INST_COUNT    /StringBuilder::<ctor>/,1
326//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
327//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
328//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
329//!
330//! METHOD        "ETSGLOBAL::if_concat_loop5"
331//! PASS_BEFORE   "BranchElimination"
332//! INST_COUNT    /StringBuilder::<ctor>/,2
333//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
334//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
335//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
336//! PASS_AFTER    "ChecksElimination"
337//! INST_COUNT    /StringBuilder::<ctor>/,1
338//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
339//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
340//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
341//!
342//! METHOD        "ETSGLOBAL::if_concat_loop6"
343//! PASS_BEFORE   "BranchElimination"
344//! INST_COUNT    /StringBuilder::<ctor>/,2
345//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
346//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
347//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
348//! PASS_AFTER    "ChecksElimination"
349//! INST_COUNT    /StringBuilder::<ctor>/,1
350//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
351//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
352//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
353//!
354//! METHOD        "ETSGLOBAL::if_concat_loop7"
355//! PASS_BEFORE   "BranchElimination"
356//! INST_COUNT    /StringBuilder::<ctor>/,2
357//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
358//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
359//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
360//! PASS_AFTER    "ChecksElimination"
361//! INST_COUNT    /StringBuilder::<ctor>/,1
362//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,1
363//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
364//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
365//!
366//! METHOD        "ETSGLOBAL::if_concat_loop8"
367//! PASS_BEFORE   "BranchElimination"
368//! INST_COUNT    /StringBuilder::<ctor>/,2
369//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
370//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
371//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
372//! PASS_AFTER    "ChecksElimination"
373//! INST_COUNT    /StringBuilder::<ctor>/,1
374//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
375//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
376//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
377//!
378//! METHOD        "ETSGLOBAL::if_concat_loop9"
379//! PASS_BEFORE   "BranchElimination"
380//! INST_COUNT    /StringBuilder::<ctor>/,2
381//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
382//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
383//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
384//! PASS_AFTER    "ChecksElimination"
385//! INST_COUNT    /StringBuilder::<ctor>/,1
386//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
387//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
388//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
389//!
390//! METHOD        "ETSGLOBAL::if_concat_loop10"
391//! PASS_BEFORE   "BranchElimination"
392//! IN_BLOCK      /loop 1, depth 1, bc: 0x00000017/
393//! INST_COUNT    /StringBuilder::<ctor>/,1
394//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,1
395//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
396//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
397//! PASS_AFTER    "SimplifyStringBuilder"
398//! IN_BLOCK      /prehead/
399//! INST_COUNT    /StringBuilder::<ctor>/,1
400//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,1
401//! PASS_AFTER    "SimplifyStringBuilder"
402//! IN_BLOCK      /loop 1, depth 1, bc: 0x00000017/
403//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
404//!
405//! METHOD        "ETSGLOBAL::if_concat_loop11"
406//! PASS_BEFORE   "BranchElimination"
407//! IN_BLOCK      /loop 1, depth 1, bc: 0x00000017/
408//! INST_COUNT    /StringBuilder::<ctor>/,1
409//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,1
410//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
411//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
412//! PASS_AFTER    "SimplifyStringBuilder"
413//! IN_BLOCK      /prehead/
414//! INST_COUNT    /StringBuilder::<ctor>/,1
415//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,1
416//! PASS_AFTER    "SimplifyStringBuilder"
417//! IN_BLOCK      /loop 1, depth 1, bc: 0x00000017/
418//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
419//!
420//! METHOD        "ETSGLOBAL::switch_concat_loop0"
421//! PASS_BEFORE   "BranchElimination"
422//! INST_COUNT    /StringBuilder::<ctor>/,6
423//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,8
424//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,4
425//! INST_COUNT    /Intrinsic.StdCoreSbToString/,6
426//! PASS_AFTER    "ChecksElimination"
427//! INST_COUNT    /StringBuilder::<ctor>/,1
428//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
429//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,4
430//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
431//!
432//! METHOD        "ETSGLOBAL::switch_concat_loop1"
433//! PASS_BEFORE   "BranchElimination"
434//! INST_COUNT    /StringBuilder::<ctor>/,6
435//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,8
436//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,4
437//! INST_COUNT    /Intrinsic.StdCoreSbToString/,6
438//! PASS_AFTER    "ChecksElimination"
439//! INST_COUNT    /StringBuilder::<ctor>/,1
440//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
441//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,4
442//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
443//!
444//! METHOD        "ETSGLOBAL::reuse_concat_loop0"
445//! PASS_BEFORE   "BranchElimination"
446//! INST_COUNT    /StringBuilder::<ctor>/,2
447//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
448//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
449//! PASS_AFTER    "ChecksElimination"
450//! INST_COUNT    /StringBuilder::<ctor>/,1
451//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
452//! INST_COUNT    /Intrinsic.StdCoreSbAppendString /,1
453//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
454//!
455//! METHOD        "ETSGLOBAL::reuse_concat_loop1"
456//! PASS_BEFORE   "BranchElimination"
457//! INST_COUNT    /StringBuilder::<ctor>/,2
458//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
459//! INST_COUNT    /Intrinsic.StdCoreSbAppendDouble/,1
460//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
461//! PASS_AFTER    "ChecksElimination"
462//! INST_COUNT    /StringBuilder::<ctor>/,1
463//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
464//! INST_COUNT    /Intrinsic.StdCoreSbAppendDouble/,1
465//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
466//!
467//! METHOD        "ETSGLOBAL::reuse_concat_loop2"
468//! PASS_BEFORE   "BranchElimination"
469//! INST_COUNT    /StringBuilder::<ctor>/,2
470//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
471//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
472//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
473//! PASS_AFTER    "ChecksElimination"
474//! INST_COUNT    /StringBuilder::<ctor>/,1
475//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
476//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
477//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
478//!
479//! METHOD        "ETSGLOBAL::reuse_concat_loop3"
480//! PASS_BEFORE   "BranchElimination"
481//! INST_COUNT    /StringBuilder::<ctor>/,2
482//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
483//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
484//! PASS_AFTER    "ChecksElimination"
485//! INST_COUNT    /StringBuilder::<ctor>/,1
486//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
487//! INST_COUNT    /Intrinsic.StdCoreSbAppendString /,1
488//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
489//!
490//! METHOD        "ETSGLOBAL::reuse_concat_loop4"
491//! PASS_BEFORE   "BranchElimination"
492//! INST_COUNT    /StringBuilder::<ctor>/,2
493//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
494//! INST_COUNT    /Intrinsic.StdCoreSbAppendDouble/,1
495//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
496//! PASS_AFTER    "ChecksElimination"
497//! INST_COUNT    /StringBuilder::<ctor>/,1
498//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
499//! INST_COUNT    /Intrinsic.StdCoreSbAppendDouble/,1
500//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
501//!
502//! METHOD        "ETSGLOBAL::reuse_concat_loop5"
503//! PASS_BEFORE   "BranchElimination"
504//! INST_COUNT    /StringBuilder::<ctor>/,2
505//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
506//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
507//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
508//! PASS_AFTER    "ChecksElimination"
509//! INST_COUNT    /StringBuilder::<ctor>/,1
510//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
511//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
512//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
513//!
514//! METHOD        "ETSGLOBAL::args_concat_loop0"
515//! PASS_BEFORE   "BranchElimination"
516//! INST_COUNT    /StringBuilder::<ctor>/,2
517//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
518//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
519//! INST_COUNT    /Intrinsic.StdCoreSbAppendBool/,1
520//! INST_COUNT    /Intrinsic.StdCoreSbAppendChar/,1
521//! INST_COUNT    /Intrinsic.StdCoreSbAppendDouble/,1
522//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
523//! PASS_AFTER    "ChecksElimination"
524//! INST_COUNT    /StringBuilder::<ctor>/,2
525//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
526//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
527//! INST_COUNT    /Intrinsic.StdCoreSbAppendBool/,1
528//! INST_COUNT    /Intrinsic.StdCoreSbAppendChar/,1
529//! INST_COUNT    /Intrinsic.StdCoreSbAppendDouble/,1
530//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
531
532//! CHECKER       JIT IR Builder, check String concatenation loop
533//! SKIP_IF       @architecture == "arm32"
534//! RUN           force_jit: true, options: "--compiler-regex='.*concat_loop[0-9]+.*' --compiler-inlining=false", entry: "ETSGLOBAL::main"
535//!
536//! METHOD        "ETSGLOBAL::concat_loop0"
537//! PASS_BEFORE   "BranchElimination"
538//! IN_BLOCK      /loop/
539//! INST          /StringBuilder::<ctor>/
540//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
541//! INST          /Intrinsic.StdCoreSbToString/
542//! PASS_AFTER    "SimplifyStringBuilder"
543//! IN_BLOCK      /prehead/
544//! INST          /StringBuilder::<ctor>/
545//! INST          /Intrinsic.StdCoreSbAppendString/
546//! PASS_AFTER    "SimplifyStringBuilder"
547//! IN_BLOCK      /loop/
548//! INST          /Intrinsic.StdCoreSbAppendString/
549//! INST_NOT      /Intrinsic.StdCoreSbToString/
550//! PASS_AFTER    "SimplifyStringBuilder"
551//! INST          /Intrinsic.StdCoreSbToString/
552//!
553//! METHOD        "ETSGLOBAL::concat_loop1"
554//! PASS_BEFORE   "BranchElimination"
555//! IN_BLOCK      /loop/
556//! INST          /StringBuilder::<ctor>/
557//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
558//! INST          /Intrinsic.StdCoreSbToString/
559//! PASS_AFTER    "SimplifyStringBuilder"
560//! IN_BLOCK      /prehead/
561//! INST          /StringBuilder::<ctor>/
562//! INST          /Intrinsic.StdCoreSbAppendString/
563//! PASS_AFTER    "SimplifyStringBuilder"
564//! IN_BLOCK      /loop/
565//! INST          /Intrinsic.StdCoreSbAppendString/
566//! INST_NOT      /Intrinsic.StdCoreSbToString/
567//! PASS_AFTER    "SimplifyStringBuilder"
568//! INST          /Intrinsic.StdCoreSbToString/
569//!
570//! METHOD        "ETSGLOBAL::concat_loop2"
571//! PASS_BEFORE   "BranchElimination"
572//! IN_BLOCK      /head, loop/
573//! INST          /StringBuilder::<ctor>/
574//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
575//! INST          /Intrinsic.StdCoreSbToString/
576//! PASS_AFTER    "SimplifyStringBuilder"
577//! IN_BLOCK      /prehead/
578//! INST          /StringBuilder::<ctor>/
579//! INST          /Intrinsic.StdCoreSbAppendString/
580//! PASS_AFTER    "SimplifyStringBuilder"
581//! IN_BLOCK      /head, loop/
582//! INST          /Intrinsic.StdCoreSbAppendString/
583//! INST_NOT      /Intrinsic.StdCoreSbToString/
584//! PASS_AFTER    "SimplifyStringBuilder"
585//! INST          /Intrinsic.StdCoreSbToString/
586//!
587//! METHOD        "ETSGLOBAL::concat_loop3"
588//! PASS_BEFORE   "BranchElimination"
589//! IN_BLOCK      /loop/
590//! INST          /StringBuilder::<ctor>/
591//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
592//! INST          /Intrinsic.StdCoreSbToString/
593//! PASS_AFTER    "SimplifyStringBuilder"
594//! IN_BLOCK      /prehead/
595//! INST          /StringBuilder::<ctor>/
596//! INST          /Intrinsic.StdCoreSbAppendString/
597//! PASS_AFTER    "SimplifyStringBuilder"
598//! IN_BLOCK      /loop/
599//! INST          /Intrinsic.StdCoreSbAppendString/
600//! INST_NOT      /Intrinsic.StdCoreSbToString/
601//! PASS_AFTER    "SimplifyStringBuilder"
602//! INST          /Intrinsic.StdCoreSbToString/
603//!
604//! METHOD        "ETSGLOBAL::concat_loop4"
605//! PASS_BEFORE   "BranchElimination"
606//! IN_BLOCK      /loop/
607//! INST          /StringBuilder::<ctor>/
608//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
609//! INST          /Intrinsic.StdCoreSbToString/
610//! PASS_AFTER    "SimplifyStringBuilder"
611//! IN_BLOCK      /prehead/
612//! INST          /StringBuilder::<ctor>/
613//! INST          /Intrinsic.StdCoreSbAppendString/
614//! PASS_AFTER    "SimplifyStringBuilder"
615//! IN_BLOCK      /loop/
616//! INST          /Intrinsic.StdCoreSbAppendString/
617//! INST_NOT      /Intrinsic.StdCoreSbToString/
618//! PASS_AFTER    "SimplifyStringBuilder"
619//! INST          /Intrinsic.StdCoreSbToString/
620//!
621//! METHOD        "ETSGLOBAL::concat_loop5"
622//! PASS_BEFORE   "BranchElimination"
623//! IN_BLOCK      /loop/
624//! INST_COUNT    /StringBuilder::<ctor>/,2
625//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
626//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
627//! PASS_AFTER    "SimplifyStringBuilder"
628//! IN_BLOCK      /prehead/
629//! INST          /StringBuilder::<ctor>/
630//! INST          /Intrinsic.StdCoreSbAppendString/
631//! PASS_AFTER    "ChecksElimination"
632//! IN_BLOCK      /loop/
633//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
634//! INST_NOT      /Intrinsic.StdCoreSbToString/
635//! PASS_AFTER    "SimplifyStringBuilder"
636//! INST          /Intrinsic.StdCoreSbToString/
637//!
638//! METHOD        "ETSGLOBAL::concat_loop7"
639//! PASS_BEFORE   "BranchElimination"
640//! IN_BLOCK      /loop/
641//! INST_COUNT    /StringBuilder::<ctor>/,2
642//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
643//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
644//! PASS_AFTER    "ChecksElimination"
645//! IN_BLOCK      /prehead/
646//! INST_COUNT    /StringBuilder::<ctor>/,1
647//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,1
648//! PASS_AFTER    "ChecksElimination"
649//! IN_BLOCK      /loop/
650//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
651//! INST_NOT      /Intrinsic.StdCoreSbToString/
652//! PASS_AFTER    "ChecksElimination"
653//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
654//!
655//! METHOD        "ETSGLOBAL::equivalent_concat_loop7"
656//! PASS_BEFORE   "BranchElimination"
657//! IN_BLOCK      /loop/
658//! INST_COUNT    /StringBuilder::<ctor>/,2
659//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
660//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
661//! PASS_AFTER    "ChecksElimination"
662//! IN_BLOCK      /prehead/
663//! INST_COUNT    /StringBuilder::<ctor>/,1
664//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,1
665//! PASS_AFTER    "ChecksElimination"
666//! IN_BLOCK      /loop/
667//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
668//! INST_NOT      /Intrinsic.StdCoreSbToString/
669//! PASS_AFTER    "ChecksElimination"
670//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
671//!
672//! METHOD        "ETSGLOBAL::concat_loop8"
673//! PASS_BEFORE   "BranchElimination"
674//! IN_BLOCK      /loop/
675//! INST_COUNT    /StringBuilder::<ctor>/,6
676//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,10
677//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
678//! INST_COUNT    /Intrinsic.StdCoreSbToString/,6
679//! PASS_AFTER    "ChecksElimination"
680//! IN_BLOCK      /prehead/
681//! INST_COUNT    /StringBuilder::<ctor>/,2
682//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
683//! PASS_AFTER    "ChecksElimination"
684//! IN_BLOCK      /loop/
685//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
686//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
687//! INST_NOT      /Intrinsic.StdCoreSbToString/
688//! PASS_AFTER    "Codegen"
689//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
690//!
691//! METHOD        "ETSGLOBAL::nested_concat_loop0"
692//! PASS_BEFORE   "BranchElimination"
693//! IN_BLOCK      /loop 3/
694//! INST          /StringBuilder::<ctor>/
695//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
696//! INST          /Intrinsic.StdCoreSbToString/
697//! PASS_AFTER    "SimplifyStringBuilder"
698//! IN_BLOCK      /prehead/
699//! INST          /StringBuilder::<ctor>/
700//! INST          /Intrinsic.StdCoreSbAppendString/
701//! PASS_AFTER    "SimplifyStringBuilder"
702//! IN_BLOCK      /loop 3/
703//! INST          /Intrinsic.StdCoreSbAppendString/
704//! INST_NOT      /Intrinsic.StdCoreSbToString/
705//! PASS_AFTER    "SimplifyStringBuilder"
706//! IN_BLOCK      /loop 2/
707//! INST_NOT      /Intrinsic.StdCoreSbToString/
708//! PASS_AFTER    "SimplifyStringBuilder"
709//! IN_BLOCK      /loop 1/
710//! INST_NOT      /Intrinsic.StdCoreSbToString/
711//! PASS_AFTER    "SimplifyStringBuilder"
712//! INST          /Intrinsic.StdCoreSbToString/
713//!
714//! METHOD        "ETSGLOBAL::try_catch_concat_loop0"
715//! PASS_BEFORE   "BranchElimination"
716//! INST_COUNT    /StringBuilder::<ctor>/,6
717//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,14
718//! INST_COUNT    /Intrinsic.StdCoreSbToString/,6
719//! PASS_AFTER    "ChecksElimination"
720//! INST_NOT      /StringBuilder::<ctor>/
721//! INST_NOT      /Intrinsic.StdCoreSbAppendString/
722//! INST_NOT      /Intrinsic.StdCoreSbAppendInt/
723//! INST_NOT      /Intrinsic.StdCoreSbToString/
724//! INST_COUNT    /Intrinsic.StdCoreStringConcat2/,3
725//! INST_COUNT    /Intrinsic.StdCoreStringConcat4/,1
726//!
727//! METHOD        "ETSGLOBAL::try_catch_concat_loop1"
728//! PASS_BEFORE   "BranchElimination"
729//! INST_COUNT    /StringBuilder::<ctor>/,2
730//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
731//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
732//! PASS_AFTER    "ChecksElimination"
733//! INST_NOT      /StringBuilder::<ctor>/
734//! INST_NOT      /Intrinsic.StdCoreSbAppendString/
735//! INST_NOT      /Intrinsic.StdCoreSbAppendInt/
736//! INST_NOT      /Intrinsic.StdCoreSbToString/
737//! INST_COUNT    /Intrinsic.StdCoreStringConcat2/,1
738//!
739//! METHOD        "ETSGLOBAL::try_catch_concat_loop2"
740//! PASS_BEFORE   "BranchElimination"
741//! INST_COUNT    /StringBuilder::<ctor>/,3
742//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,6
743//! INST_COUNT    /Intrinsic.StdCoreSbToString/,3
744//! PASS_AFTER    "ChecksElimination"
745//! INST_COUNT    /StringBuilder::<ctor>/,1
746//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
747//! INST_NOT      /Intrinsic.StdCoreSbAppendInt/
748//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
749//!
750//! METHOD        "ETSGLOBAL::try_catch_concat_loop3"
751//! PASS_BEFORE   "BranchElimination"
752//! INST_COUNT    /StringBuilder::<ctor>/,2
753//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
754//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
755//! PASS_AFTER    "ChecksElimination"
756//! INST_NOT      /StringBuilder::<ctor>/
757//! INST_NOT      /Intrinsic.StdCoreSbAppendString/
758//! INST_NOT      /Intrinsic.StdCoreSbAppendInt/
759//! INST_NOT      /Intrinsic.StdCoreSbToString/
760//! INST_COUNT    /Intrinsic.StdCoreStringConcat2/,1
761//!
762//! METHOD        "ETSGLOBAL::try_catch_concat_loop4"
763//! PASS_BEFORE   "BranchElimination"
764//! INST_COUNT    /StringBuilder::<ctor>/,1
765//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
766//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
767//! PASS_AFTER    "ChecksElimination"
768//! INST_NOT      /StringBuilder::<ctor>/
769//! INST_NOT      /Intrinsic.StdCoreSbAppendString/
770//! INST_NOT      /Intrinsic.StdCoreSbAppendInt/
771//! INST_NOT      /Intrinsic.StdCoreSbToString/
772//! INST_COUNT    /Intrinsic.StdCoreStringConcat2/,1
773//!
774//! METHOD        "ETSGLOBAL::try_catch_concat_loop5"
775//! PASS_BEFORE   "BranchElimination"
776//! INST_COUNT    /StringBuilder::<ctor>/,5
777//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,10
778//! INST_COUNT    /Intrinsic.StdCoreSbToString/,5
779//! PASS_AFTER    "ChecksElimination"
780//! INST_COUNT    /StringBuilder::<ctor>/,1
781//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
782//! INST_COUNT    /Intrinsic.StdCoreSbAppendString /,1
783//! INST_COUNT    /Intrinsic.StdCoreStringConcat2/,1
784//!
785//! METHOD        "ETSGLOBAL::if_concat_loop0"
786//! PASS_BEFORE   "BranchElimination"
787//! INST_COUNT    /StringBuilder::<ctor>/,4
788//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,6
789//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
790//! INST_COUNT    /Intrinsic.StdCoreSbToString/,4
791//! PASS_AFTER    "ChecksElimination"
792//! INST_COUNT    /StringBuilder::<ctor>/,1
793//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
794//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
795//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
796//!
797//! METHOD        "ETSGLOBAL::if_concat_loop1"
798//! PASS_BEFORE   "BranchElimination"
799//! INST_COUNT    /StringBuilder::<ctor>/,3
800//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
801//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
802//! INST_COUNT    /Intrinsic.StdCoreSbToString/,3
803//! PASS_AFTER    "ChecksElimination"
804//! INST_COUNT    /StringBuilder::<ctor>/,1
805//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
806//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
807//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
808//!
809//! METHOD        "ETSGLOBAL::if_concat_loop2"
810//! PASS_BEFORE   "BranchElimination"
811//! INST_COUNT    /StringBuilder::<ctor>/,3
812//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,5
813//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
814//! INST_COUNT    /Intrinsic.StdCoreSbToString/,3
815//! PASS_AFTER    "ChecksElimination"
816//! INST_COUNT    /StringBuilder::<ctor>/,1
817//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
818//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
819//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
820//!
821//! METHOD        "ETSGLOBAL::if_concat_loop3"
822//! PASS_BEFORE   "BranchElimination"
823//! INST_COUNT    /StringBuilder::<ctor>/,3
824//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,5
825//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
826//! INST_COUNT    /Intrinsic.StdCoreSbToString/,3
827//! PASS_AFTER    "ChecksElimination"
828//! INST_COUNT    /StringBuilder::<ctor>/,1
829//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
830//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
831//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
832//!
833//! METHOD        "ETSGLOBAL::if_concat_loop4"
834//! PASS_BEFORE   "BranchElimination"
835//! INST_COUNT    /StringBuilder::<ctor>/,3
836//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
837//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
838//! INST_COUNT    /Intrinsic.StdCoreSbToString/,3
839//! PASS_AFTER    "ChecksElimination"
840//! INST_COUNT    /StringBuilder::<ctor>/,1
841//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
842//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
843//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
844//!
845//! METHOD        "ETSGLOBAL::if_concat_loop5"
846//! PASS_BEFORE   "BranchElimination"
847//! INST_COUNT    /StringBuilder::<ctor>/,2
848//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
849//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
850//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
851//! PASS_AFTER    "ChecksElimination"
852//! INST_COUNT    /StringBuilder::<ctor>/,1
853//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
854//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
855//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
856//!
857//! METHOD        "ETSGLOBAL::if_concat_loop6"
858//! PASS_BEFORE   "BranchElimination"
859//! INST_COUNT    /StringBuilder::<ctor>/,2
860//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
861//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
862//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
863//! PASS_AFTER    "ChecksElimination"
864//! INST_COUNT    /StringBuilder::<ctor>/,1
865//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
866//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
867//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
868//!
869//! METHOD        "ETSGLOBAL::if_concat_loop7"
870//! PASS_BEFORE   "BranchElimination"
871//! INST_COUNT    /StringBuilder::<ctor>/,2
872//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
873//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
874//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
875//! PASS_AFTER    "ChecksElimination"
876//! INST_COUNT    /StringBuilder::<ctor>/,1
877//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,1
878//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,2
879//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
880//!
881//! METHOD        "ETSGLOBAL::if_concat_loop8"
882//! PASS_BEFORE   "BranchElimination"
883//! INST_COUNT    /StringBuilder::<ctor>/,2
884//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
885//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
886//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
887//! PASS_AFTER    "ChecksElimination"
888//! INST_COUNT    /StringBuilder::<ctor>/,1
889//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
890//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
891//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
892//!
893//! METHOD        "ETSGLOBAL::if_concat_loop9"
894//! PASS_BEFORE   "BranchElimination"
895//! INST_COUNT    /StringBuilder::<ctor>/,2
896//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
897//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
898//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
899//! PASS_AFTER    "ChecksElimination"
900//! INST_COUNT    /StringBuilder::<ctor>/,1
901//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
902//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
903//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
904//!
905//! METHOD        "ETSGLOBAL::if_concat_loop10"
906//! PASS_BEFORE   "BranchElimination"
907//! IN_BLOCK      /loop 1, depth 1, bc: 0x00000017/
908//! INST_COUNT    /StringBuilder::<ctor>/,1
909//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,1
910//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
911//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
912//! PASS_AFTER    "SimplifyStringBuilder"
913//! IN_BLOCK      /prehead/
914//! INST_COUNT    /StringBuilder::<ctor>/,1
915//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,1
916//! PASS_AFTER    "SimplifyStringBuilder"
917//! IN_BLOCK      /loop 1, depth 1, bc: 0x00000017/
918//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
919//!
920//! METHOD        "ETSGLOBAL::if_concat_loop11"
921//! PASS_BEFORE   "BranchElimination"
922//! IN_BLOCK      /loop 1, depth 1, bc: 0x00000017/
923//! INST_COUNT    /StringBuilder::<ctor>/,1
924//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,1
925//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
926//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
927//! PASS_AFTER    "SimplifyStringBuilder"
928//! IN_BLOCK      /prehead/
929//! INST_COUNT    /StringBuilder::<ctor>/,1
930//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,1
931//! PASS_AFTER    "SimplifyStringBuilder"
932//! IN_BLOCK      /loop 1, depth 1, bc: 0x00000017/
933//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
934//!
935//! METHOD        "ETSGLOBAL::switch_concat_loop0"
936//! PASS_BEFORE   "BranchElimination"
937//! INST_COUNT    /StringBuilder::<ctor>/,6
938//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,8
939//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,4
940//! INST_COUNT    /Intrinsic.StdCoreSbToString/,6
941//! PASS_AFTER    "ChecksElimination"
942//! INST_COUNT    /StringBuilder::<ctor>/,1
943//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
944//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,4
945//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
946//!
947//! METHOD        "ETSGLOBAL::switch_concat_loop1"
948//! PASS_BEFORE   "BranchElimination"
949//! INST_COUNT    /StringBuilder::<ctor>/,6
950//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,8
951//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,4
952//! INST_COUNT    /Intrinsic.StdCoreSbToString/,6
953//! PASS_AFTER    "ChecksElimination"
954//! INST_COUNT    /StringBuilder::<ctor>/,1
955//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
956//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,4
957//! INST_COUNT    /Intrinsic.StdCoreSbToString/,1
958//!
959//! METHOD        "ETSGLOBAL::reuse_concat_loop0"
960//! PASS_BEFORE   "BranchElimination"
961//! INST_COUNT    /StringBuilder::<ctor>/,2
962//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
963//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
964//! PASS_AFTER    "ChecksElimination"
965//! INST_COUNT    /StringBuilder::<ctor>/,1
966//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
967//! INST_COUNT    /Intrinsic.StdCoreSbAppendString /,1
968//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
969//!
970//! METHOD        "ETSGLOBAL::reuse_concat_loop1"
971//! PASS_BEFORE   "BranchElimination"
972//! INST_COUNT    /StringBuilder::<ctor>/,2
973//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
974//! INST_COUNT    /Intrinsic.StdCoreSbAppendDouble/,1
975//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
976//! PASS_AFTER    "ChecksElimination"
977//! INST_COUNT    /StringBuilder::<ctor>/,1
978//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
979//! INST_COUNT    /Intrinsic.StdCoreSbAppendDouble/,1
980//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
981//!
982//! METHOD        "ETSGLOBAL::reuse_concat_loop2"
983//! PASS_BEFORE   "BranchElimination"
984//! INST_COUNT    /StringBuilder::<ctor>/,2
985//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
986//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
987//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
988//! PASS_AFTER    "ChecksElimination"
989//! INST_COUNT    /StringBuilder::<ctor>/,1
990//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
991//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
992//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
993//!
994//! METHOD        "ETSGLOBAL::reuse_concat_loop3"
995//! PASS_BEFORE   "BranchElimination"
996//! INST_COUNT    /StringBuilder::<ctor>/,2
997//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,4
998//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
999//! PASS_AFTER    "ChecksElimination"
1000//! INST_COUNT    /StringBuilder::<ctor>/,1
1001//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
1002//! INST_COUNT    /Intrinsic.StdCoreSbAppendString /,1
1003//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
1004//!
1005//! METHOD        "ETSGLOBAL::reuse_concat_loop4"
1006//! PASS_BEFORE   "BranchElimination"
1007//! INST_COUNT    /StringBuilder::<ctor>/,2
1008//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
1009//! INST_COUNT    /Intrinsic.StdCoreSbAppendDouble/,1
1010//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
1011//! PASS_AFTER    "ChecksElimination"
1012//! INST_COUNT    /StringBuilder::<ctor>/,1
1013//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
1014//! INST_COUNT    /Intrinsic.StdCoreSbAppendDouble/,1
1015//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
1016//!
1017//! METHOD        "ETSGLOBAL::reuse_concat_loop5"
1018//! PASS_BEFORE   "BranchElimination"
1019//! INST_COUNT    /StringBuilder::<ctor>/,2
1020//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,3
1021//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
1022//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
1023//! PASS_AFTER    "ChecksElimination"
1024//! INST_COUNT    /StringBuilder::<ctor>/,1
1025//! INST_COUNT    /Intrinsic.StdCoreSbAppendString2/,1
1026//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
1027//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
1028//!
1029//! METHOD        "ETSGLOBAL::args_concat_loop0"
1030//! PASS_BEFORE   "BranchElimination"
1031//! INST_COUNT    /StringBuilder::<ctor>/,2
1032//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
1033//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
1034//! INST_COUNT    /Intrinsic.StdCoreSbAppendBool/,1
1035//! INST_COUNT    /Intrinsic.StdCoreSbAppendChar/,1
1036//! INST_COUNT    /Intrinsic.StdCoreSbAppendDouble/,1
1037//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
1038//! PASS_AFTER    "ChecksElimination"
1039//! INST_COUNT    /StringBuilder::<ctor>/,2
1040//! INST_COUNT    /Intrinsic.StdCoreSbAppendString/,2
1041//! INST_COUNT    /Intrinsic.StdCoreSbAppendInt/,1
1042//! INST_COUNT    /Intrinsic.StdCoreSbAppendBool/,1
1043//! INST_COUNT    /Intrinsic.StdCoreSbAppendChar/,1
1044//! INST_COUNT    /Intrinsic.StdCoreSbAppendDouble/,1
1045//! INST_COUNT    /Intrinsic.StdCoreSbToString/,2
1046
1047//! CHECKER       Invalid save states JIT (#I932LA/15833)
1048//! SKIP_IF       @architecture == "arm32"
1049//! RUN           force_jit: true, options: "--compiler-inlining=false --compiler-regex='.*bugfix_concat_loop1'", entry: "ETSGLOBAL::main"
1050//!
1051//! METHOD        "bugfix_concat_loop1"
1052//! PASS_BEFORE   "BranchElimination"
1053//! IN_BLOCK      /loop 1/
1054//! INST          /StringBuilder::<ctor>/
1055//! PASS_AFTER    "SimplifyStringBuilder"
1056//! IN_BLOCK      /loop 1/
1057//! INST_NOT      /StringBuilder::<ctor>/
1058
1059//! CHECKER       Invalid save states AOT (#I932LA/15833)
1060//! SKIP_IF       @architecture == "arm32"
1061//! RUN_PAOC      options: "--compiler-regex='.*bugfix_concat_loop1'"
1062//!
1063//! METHOD        "bugfix_concat_loop1"
1064//! PASS_BEFORE   "BranchElimination"
1065//! IN_BLOCK      /loop 1/
1066//! INST          /StringBuilder::<ctor>/
1067//! PASS_AFTER    "SimplifyStringBuilder"
1068//! IN_BLOCK      /loop 1/
1069//! INST_NOT      /StringBuilder::<ctor>/
1070
1071function concat_loop0(a: String, n: int): String {
1072    let str: String = "";
1073    for (let i = 0; i < n; ++i)
1074        str = str + a;                              // applied
1075    return str;
1076}
1077
1078function concat_loop1(a: String, n: int): String {
1079    let str: String = "";
1080    while (--n >= 0)
1081        str += a;                                   // applied
1082    return str;
1083}
1084
1085function concat_loop2(a: String, n: int): String {
1086    let str: String = "";
1087    do
1088        str += a;                                   // applied
1089    while (--n > 0);
1090    return str;
1091}
1092
1093function concat_loop3(a: String, n: int): String {
1094    let str: String = "";
1095    for (let i = 0; i < n; ++i, str += a);          // applied
1096    return str;
1097}
1098
1099function concat_loop4(strings: String[]): String {
1100    let str: String = "";
1101    for (let i = 0; i < strings.length; ++i) {
1102        str += strings[i];                          // applied
1103    }
1104    return str;
1105}
1106
1107function concat_loop5(strings: String[]): String {
1108    let str: String = "";
1109    for (let i = 0; i < strings.length; ++i) {
1110        str += strings[0] + strings[i];             // applied
1111    }
1112    return str;
1113}
1114
1115function concat_loop7(a: String, b: String, n: int): String {
1116    let str: String = "";
1117    for (let i = 0; i < n; ++i) {
1118        str += a;                                   // applied
1119        str += b;                                   // applied
1120    }
1121    return str;
1122}
1123
1124function equivalent_concat_loop7(a: String, b: String, n: int): String {
1125    let str: String = "";
1126    for (let i = 0; i < n; ++i) {
1127        let sb0 = new StringBuilder();              // applied
1128        sb0.append(str);
1129        sb0.append(a);
1130        let tmp1 = sb0.toString();
1131
1132        let sb1 = new StringBuilder();              // applied
1133        sb1.append(tmp1);
1134        sb1.append(b);
1135        str = sb1.toString();
1136    }
1137    return str;
1138}
1139
1140function concat_loop8(a: String, b: String, n: int): String {
1141    let a1b: String = "";
1142    let b2a: String = "";
1143    for (let i = 0; i < n; ++i) {
1144        a1b += a + 1;                               // applied
1145        a1b += b;                                   // applied
1146
1147        b2a += b + 2;                               // applied
1148        b2a += a;                                   // applied
1149    }
1150    return a1b + "." + b2a;
1151}
1152
1153function nested_concat_loop0(a: String, n: int): String {
1154    let str: String = "";
1155    for (let i = 0; i < n; ++i)
1156        for (let j = 0; j < n; ++j)
1157            for (let k = 0; k < n; ++k)
1158                str = str + a;                      // applied, instructions moved out of outermost loop
1159    return str;
1160}
1161
1162function try_catch_concat_loop0(a: String, n: int): String {
1163    let str_try: String = "";
1164    let str_catch: String = "";
1165    let str_finally: String = "";
1166    let str: String = "";
1167    for (let i = 0; i < n; ++i) {
1168        str += a;                                   // not applied due to loop containing try-catch-finally blocks
1169                                                    // replaced by concat intrinsic
1170        try {
1171            str_try += a;                           // not applied due to being inside try-block
1172                                                    // replaced by concat intrinsic
1173        }
1174        catch(ex) {
1175            str_catch += a;                         // not applied due to being inside catch-block
1176                                                    // replaced by concat intrinsic
1177        }
1178        finally {
1179            str_finally += a;                       // not applied due to being inside finally-block
1180                                                    // replaced by concat intrinsic
1181        }
1182    }
1183    return str + str_try + str_catch + str_finally; // replaced by concat intrinsic
1184}
1185
1186function try_catch_concat_loop1(a: String, n: int): String {
1187    let str: String = "";
1188    for (let i = 0; i < n; ++i)
1189        try {
1190            str = str + a;                          // not applied
1191                                                    // replaced by concat intrinsic
1192        }
1193        catch(ex) {
1194            str = str + a;                          // not applied
1195                                                    // replaced by concat intrinsic
1196        }
1197    return str;
1198}
1199
1200function try_catch_concat_loop2(a: String, n: int): String {
1201    let str: String = "";
1202    for (let i = 0; i < n; ++i)
1203        try {
1204            str = str + a;                          // not applied
1205                                                    // replaced by concat intrinsic
1206        }
1207        finally {
1208            str = str + a;                          // partially applied
1209                                                    // SB merged with the one inside try-block
1210        }
1211    return str;
1212}
1213
1214function try_catch_concat_loop3(a: String, n: int): String {
1215    let str: String = "";
1216    for (let i = 0; i < n; ++i)
1217        try {
1218            for (let j = 0; j < n; ++j) {
1219                str += a;                       // not applied due to loop containing try-catch-finally blocks
1220                                                // replaced by concat intrinsic
1221            }
1222        }
1223        catch(ex) {
1224            for (let j = 0; j < n; ++j) {
1225                str += a;                       // not applied
1226                                                // replaced by concat intrinsic
1227            }
1228        }
1229    return str;
1230}
1231
1232function try_catch_concat_loop4(a: String, n: int): String {
1233    let str: String = "";
1234    try {
1235        for (let i = 0; i < n; ++i)
1236            str += a;                           // not applied due to loop containing try-catch-finally blocks
1237                                                // replaced by concat intrinsic
1238    }
1239    catch(ex) {}
1240    return str;
1241}
1242
1243function try_catch_concat_loop5(a: String, n: int): String {
1244    let str: String = "";
1245    for (let i = 0; i < n; ++i) {
1246        str += a;                   // not applied due to loop containing try-catch-finally blocks
1247                                    // replaced by concat intrinsic
1248        try {
1249            str += a;               // partially applied
1250                                    // SBs inside try, catch, and finally blocks merged into one
1251        }
1252        catch(ex) {
1253            str += a;               // partially applied
1254                                    // SBs inside try, catch, and finally blocks merged into one
1255        }
1256        finally {
1257            str += a;               // partially applied
1258                                    // SBs inside try, catch, and finally blocks merged into one
1259        }
1260    }
1261    return str;
1262}
1263
1264function if_concat_loop0(a: String, b: String, n: int): String {
1265    let str: String = "";
1266    for (let i = 0; i < n; ++i) {
1267        str += a;                               // applied
1268        if (i < n/2)
1269            str += 1;                           // applied
1270        else
1271            str += 2;                           // applied
1272        str += b;                               // applied
1273    }
1274    return str;
1275}
1276
1277function if_concat_loop1(a: String, n: int): String {
1278    let str: String = "";
1279    for (let i = 0; i < n; ++i) {
1280        str += a;                               // applied
1281        if (i < n/2)
1282            str += 1;                           // applied
1283        else
1284            str += 2;                           // applied
1285    }
1286    return str;
1287}
1288
1289function if_concat_loop2(a: String, b: String, n: int): String {
1290    let str: String = "";
1291    for (let i = 0; i < n; ++i) {
1292        str += a;                               // applied
1293        if (i < n/2)
1294            str += 1;                           // applied
1295        str += b;                               // applied
1296    }
1297    return str;
1298}
1299
1300function if_concat_loop3(a: String, b: String, n: int): String {
1301    let str: String = "";
1302    for (let i = 0; i < n; ++i) {
1303        str += a;                               // applied
1304        if (i < n/2) {
1305        }
1306        else
1307            str += 2;                           // applied
1308        str += b;                               // applied
1309    }
1310    return str;
1311}
1312
1313function if_concat_loop4(b: String, n: int): String {
1314    let str: String = "";
1315    for (let i = 0; i < n; ++i) {
1316        if (i < n/2)
1317            str += 1;                           // applied
1318        else
1319            str += 2;                           // applied
1320        str += b;                               // applied
1321    }
1322    return str;
1323}
1324
1325function if_concat_loop5(a: String, n: int): String {
1326    let str: String = "";
1327    for (let i = 0; i < n; ++i) {
1328        str += a;                               // applied
1329        if (i < n/2)
1330            str += 1;                           // applied
1331    }
1332    return str;
1333}
1334
1335function if_concat_loop6(a: String, n: int): String {
1336    let str: String = "";
1337    for (let i = 0; i < n; ++i) {
1338        str += a;                               // applied
1339        if (i < n/2) {
1340        }
1341        else
1342            str += 2;                           // applied
1343    }
1344    return str;
1345}
1346
1347function if_concat_loop7(n: int): String {
1348    let str: String = "";
1349    for (let i = 0; i < n; ++i) {
1350        if (i < n/2)
1351            str += 1;                           // applied
1352        else
1353            str += 2;                           // applied
1354    }
1355    return str;
1356}
1357
1358function if_concat_loop8(b: String, n: int): String {
1359    let str: String = "";
1360    for (let i = 0; i < n; ++i) {
1361        if (i < n/2) {
1362        }
1363        else
1364            str += 2;                           // applied
1365        str += b;                               // applied
1366    }
1367    return str;
1368}
1369
1370function if_concat_loop9(b: String, n: int): String {
1371    let str: String = "";
1372    for (let i = 0; i < n; ++i) {
1373        if (i < n/2)
1374            str += 1;                           // applied
1375        str += b;                               // applied
1376    }
1377    return str;
1378}
1379
1380function if_concat_loop10(n: int): String {
1381    let str: String = "";
1382    for (let i = 0; i < n; ++i) {
1383        if (i < n/2)
1384            str += 1;                           // applied
1385    }
1386    return str;
1387}
1388
1389function if_concat_loop11(n: int): String {
1390    let str: String = "";
1391    for (let i = 0; i < n; ++i) {
1392        if (i < n/2) {
1393        }
1394        else
1395            str += 2;                           // applied
1396    }
1397    return str;
1398}
1399
1400function switch_concat_loop0(a: String, b: String, n: int): String {
1401    let str: String = "";
1402    for (let i = 0; i < n; ++i) {
1403        str += a;                               // applied
1404        switch (i) {
1405            case 0:
1406                str += 0;                       // applied
1407                break;
1408            case 1:
1409                str += 1;                       // applied
1410                break;
1411            case 2:
1412                str += 2;                       // applied
1413                break;
1414            default:
1415                str += i;                       // applied
1416                break;
1417        }
1418        str += b;                               // applied
1419    }
1420    return str;
1421}
1422
1423function switch_concat_loop1(a: String, b: String, n: int): String {
1424    let str: String = "";
1425    for (let i = 0; i < n; ++i) {
1426        str += a;                               // applied
1427        switch (i) {
1428            case 0:
1429                str += 0;                       // applied
1430            case 1:
1431                str += 1;                       // applied
1432            case 2:
1433                str += 2;                       // applied
1434            default:
1435                str += i;                       // applied
1436        }
1437        str += b;                               // applied
1438    }
1439    return str;
1440}
1441
1442function reuse_concat_loop0(a: String, n: int): String {
1443    let str: String = "";
1444    for (let i = 0; i < n; ++i) {
1445        str += str;                             // partially applied
1446        str += a;                               // two SBs merged into one
1447    }
1448    return str;
1449}
1450
1451function reuse_concat_loop1(a: String, n: int): String {
1452    let str: String = "";
1453    for (let i = 0; i < n; ++i) {
1454        str += str.length;                      // partially applied
1455        str += a;                               // two SBs merged into one
1456    }
1457    return str;
1458}
1459
1460function reuse_concat_loop2(a: String, n: int): String {
1461    let str: String = "";
1462    for (let i = 0; i < n; ++i) {
1463        str += str.getLength();                 // partially applied
1464        str += a;                               // two SBs merged into one
1465    }
1466    return str;
1467}
1468
1469function reuse_concat_loop3(a: String, n: int): String {
1470    let str: String = "";
1471    for (let i = 0; i < n; ++i) {
1472        str += a;                               // partially applied
1473        str += str;                             // two SBs merged into one
1474    }
1475    return str;
1476}
1477
1478function reuse_concat_loop4(a: String, n: int): String {
1479    let str: String = "";
1480    for (let i = 0; i < n; ++i) {
1481        str += a;                               // partially applied
1482        str += str.length;                      // two SBs merged into one
1483    }
1484    return str;
1485}
1486
1487function reuse_concat_loop5(a: String, n: int): String {
1488    let str: String = "";
1489    for (let i = 0; i < n; ++i) {
1490        str += a;                               // partially applied
1491        str += str.getLength();                 // two SBs merged into one
1492    }
1493    return str;
1494}
1495
1496function args_concat_loop0(x: double, y: boolean, ...p: char[]): string
1497{
1498    let res: string = "" + x + y + p.length;    // not replaced by intrinsic due to concatenating float, bool, int
1499    for (let ch of p) res += ch;                // not applied due to exit block not dominated by preheader
1500    return res;
1501}
1502
1503function bugfix_concat_loop0(): String {
1504    let res = ""
1505    for (let i = 0; i < 1; ++i)
1506    {
1507        if (i < 0) {
1508            res += "0"
1509        }
1510        else
1511        {
1512            res += "12345"
1513            res += "678"
1514        }
1515    }
1516    return res
1517}
1518
1519function bugfix_concat_loop1(size: int, charset: string): string {
1520    let res: string = new string()
1521
1522    switch (charset) {
1523        case "ISO-8859-1":
1524            for (let i = 0; i < size; ++i)
1525                res += string.fromCharCode(0x43 as number)
1526        break
1527        case "UTF-16":
1528            for (let i = 0; i < size; ++i)
1529                res += string.fromCharCode(0xD799 as number)
1530        break
1531    }
1532
1533    return res
1534}
1535
1536function main() {
1537    assert concat_loop0("a", 4) == "aaaa": "Wrong result at concat_loop0";
1538    assert concat_loop1("a", 4) == "aaaa": "Wrong result at concat_loop1";
1539    assert concat_loop2("a", 4) == "aaaa": "Wrong result at concat_loop2";
1540    assert concat_loop3("a", 4) == "aaaa": "Wrong result at concat_loop3";
1541    assert concat_loop4(["a", "b", "c", "d"]) == "abcd": "Wrong result at concat_loop4";
1542    assert concat_loop5(["a", "b", "c", "d"]) == "aaabacad": "Wrong result at concat_loop5";
1543    assert concat_loop7("a", "b", 4) == "abababab": "Wrong result at concat_loop7";
1544    assert equivalent_concat_loop7("a", "b", 4) == "abababab": "Wrong result at equivalent_concat_loop7";
1545    assert concat_loop8("a", "b", 4) == "a1ba1ba1ba1b.b2ab2ab2ab2a": "Wrong result at concat_loop8";
1546    assert nested_concat_loop0("a", 2) == "aaaaaaaa": "Wrong result at nested_concat_loop0";
1547    assert try_catch_concat_loop0("a", 4) == "aaaaaaaaaaaa": "Wrong result at try_catch_concat_loop0";
1548    assert try_catch_concat_loop1("a", 4) == "aaaa": "Wrong result at try_catch_concat_loop1";
1549    assert try_catch_concat_loop2("a", 4) == "aaaaaaaa": "Wrong result at try_catch_concat_loop2";
1550    assert try_catch_concat_loop3("a", 2) == "aaaa": "Wrong result at try_catch_concat_loop3";
1551    assert try_catch_concat_loop4("a", 4) == "aaaa": "Wrong result at try_catch_concat_loop4";
1552    assert try_catch_concat_loop5("a", 4) == "aaaaaaaaaaaa": "Wrong result at try_catch_concat_loop5";
1553    assert if_concat_loop0("a", "b", 4) == "a1ba1ba2ba2b": "Wrong result at if_concat_loop0";
1554    assert if_concat_loop1("a", 4) == "a1a1a2a2": "Wrong result at if_concat_loop1";
1555    assert if_concat_loop2("a", "b", 4) == "a1ba1babab": "Wrong result at if_concat_loop2";
1556    assert if_concat_loop3("a", "b", 4) == "ababa2ba2b": "Wrong result at if_concat_loop3";
1557    assert if_concat_loop4("b", 4) == "1b1b2b2b": "Wrong result at if_concat_loop4";
1558    assert if_concat_loop5("a", 4) == "a1a1aa": "Wrong result at if_concat_loop5";
1559    assert if_concat_loop6("a", 4) == "aaa2a2": "Wrong result at if_concat_loop6";
1560    assert if_concat_loop7(4) == "1122": "Wrong result at if_concat_loop7";
1561    assert if_concat_loop8("b", 4) == "bb2b2b": "Wrong result at if_concat_loop8";
1562    assert if_concat_loop9("b", 4) == "1b1bbb": "Wrong result at if_concat_loop9";
1563    assert if_concat_loop10(4) == "11": "Wrong result at if_concat_loop10";
1564    assert if_concat_loop11(4) == "22": "Wrong result at if_concat_loop11";
1565    assert switch_concat_loop0("a", "b", 4) == "a0ba1ba2ba3b": "Wrong result at switch_concat_loop0";
1566    assert switch_concat_loop1("a", "b", 4) == "a0120ba121ba22ba3b": "Wrong result at switch_concat_loop1";
1567    assert reuse_concat_loop0("a", 4) == "aaaaaaaaaaaaaaa": "Wrong result at reuse_concat_loop0";
1568    assert reuse_concat_loop1("a", 4) == "0a2a4a6a": "Wrong result at reuse_concat_loop1";
1569    assert reuse_concat_loop2("a", 4) == "0a2a4a6a": "Wrong result at reuse_concat_loop2";
1570    assert reuse_concat_loop3("a", 4) == "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa": "Wrong result at reuse_concat_loop3";
1571    assert reuse_concat_loop4("a", 4) == "a1a3a5a7": "Wrong result at reuse_concat_loop4";
1572    assert reuse_concat_loop5("a", 4) == "a1a3a5a7": "Wrong result at reuse_concat_loop5";
1573    assert args_concat_loop0(1.5, false, c'A', c'B') == "1.5false2AB": "Wrong result at args_concat_loop0";
1574    assert bugfix_concat_loop0() == "12345678": "Wrong result at bugfix_concat_loop0";
1575    assert bugfix_concat_loop1(4, "ISO-8859-1") == "CCCC": "Wrong result at bugfix_concat_loop1"
1576    assert bugfix_concat_loop1(4, "UTF-16") == "힙힙힙힙": "Wrong result at bugfix_concat_loop1"
1577}
1578
1579//! CHECKER       Invalid save states AOT (I9NI8P/16707)
1580//! SKIP_IF       @architecture == "arm32"
1581//! RUN_PAOC      options: "--compiler-regex='.*bugfix_concat_loop2_test[0-9]+' --compiler-inlining=true"
1582
1583//! CHECKER       Invalid save states JIT (I9NI8P/16707)
1584//! SKIP_IF       @architecture == "arm32"
1585//! RUN           force_jit: true, entry: "ETSGLOBAL::bugfix_concat_loop2"
1586
1587const initial = "initial";
1588const expected = "expected";
1589const empty = "";
1590
1591function bugfix_concat_loop2_test0(): string {
1592    let c = initial;
1593    let b = expected;
1594    for(let a = 0; a < 1; a++) {
1595        b += empty;
1596        c = b;
1597    }
1598    return c;
1599}
1600
1601function bugfix_concat_loop2_test1(): string {
1602    let c = initial;
1603    let b = expected;
1604    for(let a = 0; a < 1; a++) {
1605        if (a == 1)
1606            b += empty;
1607        else
1608            c = b;
1609    }
1610    return c;
1611}
1612
1613function bugfix_concat_loop2_test2(): string {
1614    let c = initial;
1615    let b = expected;
1616    for(let a = 0; a < 1; a++) {
1617        if (a == 1)
1618            b += empty;
1619        c = b;
1620    }
1621    return c;
1622}
1623
1624function bugfix_concat_loop2_test3(): string {
1625    let c = initial;
1626    let b = expected;
1627    for(let a = 0; a < 1; a++) {
1628        b += empty;
1629        if (a == 0)
1630            c = b;
1631    }
1632    return c;
1633}
1634
1635function bugfix_concat_loop2_test4(): string {
1636    let c = initial;
1637    let b = expected;
1638    for(let a = 0; a < 1; a++) {
1639        b += empty;
1640        if (a == 1) {}
1641        else
1642            c = b;
1643    }
1644    return c;
1645}
1646
1647function bugfix_concat_loop2_test5(): string {
1648    let c = initial;
1649    let b = expected;
1650    for(let a = 0; a < 1; a++) {
1651        if (a == 1) {}
1652        else
1653            b += empty;
1654        c = b;
1655    }
1656    return c;
1657}
1658
1659function bugfix_concat_loop2() {
1660    for(let i = 0; i < 5000; i++) {
1661        assert bugfix_concat_loop2_test0() == expected;
1662        assert bugfix_concat_loop2_test1() == expected;
1663        assert bugfix_concat_loop2_test2() == expected;
1664        assert bugfix_concat_loop2_test3() == expected;
1665        assert bugfix_concat_loop2_test4() == expected;
1666        assert bugfix_concat_loop2_test5() == expected;
1667    }
1668}
1669
1670//! CHECKER       Invalid phi instruction AOT (IARN2S/19226)
1671//! SKIP_IF       @architecture == "arm32"
1672//! RUN_PAOC      options: "--compiler-regex='.*bugfix_concat_loop3' --compiler-loop-unroll=false --compiler-inlining=true"
1673
1674//! CHECKER       Invalid phi instruction JIT (IARN2S/19226)
1675//! SKIP_IF       @architecture == "arm32"
1676//! RUN           force_jit: true, options: "--compiler-loop-unroll=false", entry: "ETSGLOBAL::bugfix_concat_loop3"
1677
1678function bugfix_concat_loop3() {
1679    let str = "";
1680    let a2 : string[] = ["ddd"]
1681    let idx2 : string | boolean;
1682    for (idx2 of a2) {
1683        let c2 = idx2
1684        if (c2 instanceof string) {
1685            str += c2;
1686        }
1687    }
1688
1689    assert(str == "ddd");
1690}