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