30 for (; loop !=
nullptr; loop = loop->
next()) {
32 f->Printf(
"%*c[%" Pd "\n",
static_cast<int>(2 * depth),
' ', loop->
id());
36 if (block->IsJoinEntry()) {
39 if (induc !=
nullptr) {
41 f->Printf(
"%*c%s",
static_cast<int>(2 * depth),
' ',
43 for (
auto bound : induc->
bounds()) {
44 f->Printf(
" %s", bound.limit_->ToCString());
54 f->Printf(
"%*c%s\n",
static_cast<int>(2 * depth),
' ',
60 f->Printf(
"%*c]\n",
static_cast<int>(2 * depth),
' ');
68 Invoke(root_library,
"main");
70 std::initializer_list<CompilerPass::Id> passes = {
71 CompilerPass::kComputeSSA,
72 CompilerPass::kTypePropagation,
73 CompilerPass::kApplyICData,
74 CompilerPass::kTypePropagation,
75 CompilerPass::kSelectRepresentations,
76 CompilerPass::kTypePropagation,
77 CompilerPass::kCanonicalize,
100 const char* script_chars =
103 for (int i = 0; i < 100; i++) {
110 const char* expected =
112 " LIN(0 + 1 * i) 100\n"
119 const char* script_chars =
122 for (int i = 100; i > 0; i--) {
129 const char* expected =
131 " LIN(100 + -1 * i) 0\n"
132 " LIN(99 + -1 * i)\n"
138 const char* script_chars =
141 for (int i = 10; i < 100; i += 2) {
148 const char* expected =
157 const char* script_chars =
160 for (int i = 100; i >= 0; i -= 7) {
167 const char* expected =
169 " LIN(100 + -7 * i)\n"
170 " LIN(93 + -7 * i)\n"
176 const char* script_chars =
179 for (int i = 0; i < 100; i++) {
180 for (int j = 1; j < 100; j++) {
181 for (int k = 2; k < 100; k++) {
190 const char* expected =
192 " LIN(0 + 1 * i) 100\n"
195 " LIN(1 + 1 * i) 100\n"
198 " LIN(2 + 1 * i) 100\n"
207 const char* script_chars =
211 for (int i = 0; i < 100; i++) {
220 const char* expected =
223 " LIN(0 + 1 * i) 100\n"
225 " LIN(13 + 12 * i)\n"
232 const char* script_chars =
236 for (int i = 0; i < 100; i++) {
248 const char* expected =
250 " LIN(123 + 3 * i)\n"
251 " LIN(0 + 1 * i) 100\n"
252 " LIN(126 + 3 * i)\n"
253 " LIN(126 + 3 * i)\n"
255 " LIN(126 + 3 * i)\n"
261 const char* script_chars =
264 for (int i = 1; i < 100; i++) {
275 const char* expected =
277 " LIN(1 + 1 * i) 100\n"
281 " LIN(-1 + -1 * i)\n"
288 const char* script_chars =
292 for (int i = 0; i < 100; i++) {
304 const char* expected =
306 " WRAP(99, LIN(0 + 1 * i))\n"
307 " LIN(0 + 1 * i) 100\n"
308 " WRAP(102, LIN(3 + 1 * i))\n"
309 " WRAP(94, LIN(-5 + 1 * i))\n"
310 " WRAP(693, LIN(0 + 7 * i))\n"
311 " WRAP(-99, LIN(0 + -1 * i))\n"
318 const char* script_chars =
323 for (int i = 0; i < 100; i++) {
336 const char* expected =
340 " LIN(0 + 1 * i) 100\n"
357 const char* script_chars =
360 for (int i = 0; i <= 100; i++) {
367 const char* expected =
369 " LIN(0 + 1 * i) 101\n"
376 const char* script_chars =
379 for (int i = 0x7ffffffffffffffe; i <= 0x7fffffffffffffff; i++) {
387 const char* expected =
389 " LIN(9223372036854775806 + 1 * i)\n"
390 " LIN(9223372036854775807 + 1 * i)\n"
396 const char* script_chars =
399 for (int i = 100; i >= 0; i--) {
406 const char* expected =
408 " LIN(100 + -1 * i) -1\n"
409 " LIN(99 + -1 * i)\n"
415 const char* script_chars =
418 for (int i = 0x8000000000000001; i >= 0x8000000000000000; i--) {
426 const char* expected =
428 " LIN(-9223372036854775807 + -1 * i)\n"
429 " LIN(-9223372036854775808 + -1 * i)\n"
435 const char* script_chars =
438 for (int i = 10; i != 20; i++) {
445 const char* expected =
447 " LIN(10 + 1 * i) 20\n"
454 const char* script_chars =
457 for (int i = 20; i != 10; i--) {
464 const char* expected =
466 " LIN(20 + -1 * i) 10\n"
467 " LIN(19 + -1 * i)\n"
473 const char* script_chars =
476 for (int i = 0; i < 100; i++) {
484 const char* expected =
486 " LIN(0 + 1 * i) 100 50\n"
493 const char* script_chars =
496 for (int i = 100; i > 0; i--) {
504 const char* expected =
506 " LIN(100 + -1 * i) 0 10\n"
507 " LIN(99 + -1 * i)\n"
void RemoveRedefinitions(bool keep_checks=false)
const GrowableArray< BlockEntryInstr * > & preorder() const
const LoopHierarchy & GetLoopHierarchy()
const GrowableArray< Bound > & bounds()
static bool IsInduction(const InductionVar *x)
const char * ToCString() const
void ComputeInduction() const
InductionVar * LookupInduction(Definition *def) const
BitVector * blocks() const
intptr_t NestingDepth() const
FlowGraph * RunPasses(std::initializer_list< CompilerPass::Id > passes)
static Thread * Current()
char * MakeCopyOfString(const char *str)
static const uint8_t buffer[]
Dart_NativeFunction function
LibraryPtr LoadTestScript(const char *script, Dart_NativeEntryResolver resolver, const char *lib_uri)
void TestString(BaseTextBuffer *f, LoopInfo *loop, const GrowableArray< BlockEntryInstr * > &preorder)
ObjectPtr Invoke(const Library &lib, const char *name)
FunctionPtr GetFunction(const Library &lib, const char *name)
static const char * ComputeInduction(Thread *thread, const char *script_chars)
#define ISOLATE_UNIT_TEST_CASE(name)