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