Remove LOOP_EXIT

This commit is contained in:
Dmitry Stogov 2022-06-15 17:27:31 +03:00
parent 706850f578
commit 5fb115ab11
32 changed files with 140 additions and 263 deletions

3
ir.h
View File

@ -118,7 +118,7 @@ typedef enum _ir_type {
* arg - argument referene CALL/TAILCALL/CARG->CARG
* src - reference to a previous control region (IF, IF_TRUE, IF_FALSE, LOOP_BEGIN, LOOP_END, RETURN)
* reg - data-control dependency on region (PHI, VAR, PARAM)
* beg - reference to a LOOP_BEGIN region (LOOP_END, LOOP_EXIT)
* beg - reference to a LOOP_BEGIN region (LOOP_END)
* ret - reference to a previous RETURN instruction (RETURN)
* ent - reference to a previous ENTRY instruction (ENTRY)
* str - string: variable/argument name (VAR, PARAM, CALL, TAILCALL)
@ -250,7 +250,6 @@ typedef enum _ir_type {
_(MERGE, BN, src, src, src) /* control merge */ \
_(LOOP_BEGIN, B2, src, src, ___) /* loop start */ \
_(LOOP_END, E1X1, src, beg, ___) /* loop end */ \
_(LOOP_EXIT, c1X1, src, beg, ___) /* loop exit */ \
_(IJMP, E2X1, src, def, ret) /* computed goto */ \
\
/* guards (floating or not) ??? */ \

View File

@ -929,7 +929,6 @@ binop_fp:
case IR_MERGE:
case IR_LOOP_BEGIN:
// case IR_LOOP_END:
case IR_LOOP_EXIT:
case IR_UNREACHABLE:
return IR_SKIP;
case IR_RETURN:
@ -3952,7 +3951,6 @@ static void ir_allocate_unique_spill_slots(ir_ctx *ctx)
case IR_MERGE:
case IR_LOOP_BEGIN:
case IR_LOOP_END:
case IR_LOOP_EXIT:
break;
default:
flags = 0;

View File

@ -739,7 +739,6 @@ static int ir_emit_func(ir_ctx *ctx, FILE *f)
case IR_MERGE:
case IR_LOOP_BEGIN:
case IR_LOOP_END:
case IR_LOOP_EXIT:
case IR_PARAM:
case IR_VAR:
case IR_PHI:
@ -802,7 +801,6 @@ static int ir_emit_func(ir_ctx *ctx, FILE *f)
case IR_CASE_DEFAULT:
case IR_MERGE:
case IR_LOOP_BEGIN:
case IR_LOOP_EXIT:
case IR_UNREACHABLE:
case IR_PARAM:
case IR_VAR:

View File

@ -1662,7 +1662,6 @@ store_int:
case IR_MERGE:
case IR_LOOP_BEGIN:
// case IR_LOOP_END:
case IR_LOOP_EXIT:
case IR_UNREACHABLE:
return IR_SKIP;
case IR_RETURN:
@ -6064,7 +6063,6 @@ static void ir_allocate_unique_spill_slots(ir_ctx *ctx)
case IR_MERGE:
case IR_LOOP_BEGIN:
case IR_LOOP_END:
case IR_LOOP_EXIT:
break;
default:
flags = 0;

View File

@ -11,7 +11,7 @@
int32_t c_5 = 2;
int32_t c_6 = 1;
int32_t c_7 = 0;
l_1 = START(l_16);
l_1 = START(l_14);
int32_t d_2 = PARAM(l_1, "x", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_12);
@ -24,9 +24,7 @@
l_11 = IF_TRUE(l_10);
l_12 = LOOP_END(l_11, l_4);
l_13 = IF_FALSE(l_10);
l_14 = LOOP_EXIT(l_13, l_4);
l_15 = BEGIN(l_14);
l_16 = RETURN(l_15, d_8);
l_14 = RETURN(l_13, d_8);
}
--EXPECT--
{ # CFG
@ -58,15 +56,7 @@ BB3:
BB4:
start=13
end=14
successors(1) [BB5]
predecessors(1) [BB2]
dom_parent=BB2
dom_depth=2
dom_children [BB5]
BB5:
start=15
end=16
predecessors(1) [BB4]
dom_parent=BB4
dom_depth=3
}

View File

@ -11,7 +11,7 @@
int32_t c_5 = 2;
int32_t c_6 = 1;
int32_t c_7 = 0;
l_1 = START(l_16);
l_1 = START(l_14);
int32_t d_2 = PARAM(l_1, "x", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_12);
@ -24,9 +24,7 @@
l_11 = IF_TRUE(l_10);
l_12 = LOOP_END(l_11, l_4);
l_13 = IF_FALSE(l_10);
l_14 = LOOP_EXIT(l_13, l_4);
l_15 = BEGIN(l_14);
l_16 = RETURN(l_15, d_8);
l_14 = RETURN(l_13, d_8);
}
--EXPECT--
{
@ -37,7 +35,7 @@
int32_t c_5 = 2;
int32_t c_6 = 1;
int32_t c_7 = 0;
l_1 = START(l_16);
l_1 = START(l_14);
int32_t d_2 = PARAM(l_1, "x", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_12);
@ -50,9 +48,7 @@
l_11 = IF_TRUE(l_10);
l_12 = LOOP_END(l_11, l_4);
l_13 = IF_FALSE(l_10);
l_14 = LOOP_EXIT(l_13, l_4);
l_15 = BEGIN(l_14);
l_16 = RETURN(l_15, d_8);
l_14 = RETURN(l_13, d_8);
}
{ # CFG map (insn -> bb)
1 -> 1
@ -62,13 +58,11 @@
5 -> 2
6 -> 1
7 -> 2
8 -> 5
8 -> 4
9 -> 2
10 -> 2
11 -> 3
12 -> 3
13 -> 4
14 -> 4
15 -> 5
16 -> 5
}

View File

@ -52,17 +52,15 @@
l_41 = IF_TRUE(l_40);
l_42 = LOOP_END(l_41, l_13);
l_43 = IF_FALSE(l_40);
l_44 = LOOP_EXIT(l_43, l_13);
l_45 = BEGIN(l_44);
int32_t d_46 = ADD(d_32, d_3);
int32_t d_47 = ADD(d_46, d_4);
int32_t d_48 = ADD(d_47, d_33);
int32_t d_49 = ADD(d_48, d_34);
int32_t d_50 = ADD(d_49, d_35);
int32_t d_51 = ADD(d_50, d_36);
int32_t d_52 = ADD(d_51, d_37);
int32_t d_53 = ADD(d_52, d_39);
l_54 = RETURN(l_45, d_53);
int32_t d_44 = ADD(d_32, d_3);
int32_t d_45 = ADD(d_44, d_4);
int32_t d_46 = ADD(d_45, d_33);
int32_t d_47 = ADD(d_46, d_34);
int32_t d_48 = ADD(d_47, d_35);
int32_t d_49 = ADD(d_48, d_36);
int32_t d_50 = ADD(d_49, d_37);
int32_t d_51 = ADD(d_50, d_39);
l_54 = RETURN(l_43, d_51);
}
--EXPECT--
{ # CFG
@ -121,16 +119,8 @@ BB6:
loop_depth=1
BB7:
start=39
end=40
successors(1) [BB8]
end=48
predecessors(1) [BB5]
dom_parent=BB5
dom_depth=3
dom_children [BB8]
BB8:
start=41
end=50
predecessors(1) [BB7]
dom_parent=BB7
dom_depth=4
}

View File

@ -9,7 +9,7 @@
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 4;
l_1 = START(l_54);
l_1 = START(l_52);
int32_t d_2 = PARAM(l_1, "a", 0);
int32_t d_3 = PARAM(l_1, "b", 1);
int32_t d_4 = PARAM(l_1, "c", 2);
@ -52,17 +52,15 @@
l_41 = IF_TRUE(l_40);
l_42 = LOOP_END(l_41, l_13);
l_43 = IF_FALSE(l_40);
l_44 = LOOP_EXIT(l_43, l_13);
l_45 = BEGIN(l_44);
int32_t d_46 = ADD(d_32, d_3);
int32_t d_47 = ADD(d_46, d_4);
int32_t d_48 = ADD(d_47, d_33);
int32_t d_49 = ADD(d_48, d_34);
int32_t d_50 = ADD(d_49, d_35);
int32_t d_51 = ADD(d_50, d_36);
int32_t d_52 = ADD(d_51, d_37);
int32_t d_53 = ADD(d_52, d_39);
l_54 = RETURN(l_45, d_53);
int32_t d_44 = ADD(d_32, d_3);
int32_t d_45 = ADD(d_44, d_4);
int32_t d_46 = ADD(d_45, d_33);
int32_t d_47 = ADD(d_46, d_34);
int32_t d_48 = ADD(d_47, d_35);
int32_t d_49 = ADD(d_48, d_36);
int32_t d_50 = ADD(d_49, d_37);
int32_t d_51 = ADD(d_50, d_39);
l_52 = RETURN(l_43, d_51);
}
--EXPECT--
{
@ -71,7 +69,7 @@
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 4;
l_1 = START(l_50);
l_1 = START(l_48);
int32_t d_2 = PARAM(l_1, "a", 0);
int32_t d_3 = PARAM(l_1, "b", 1);
int32_t d_4 = PARAM(l_1, "c", 2);
@ -110,17 +108,15 @@
l_37 = IF_TRUE(l_36);
l_38 = LOOP_END(l_37, l_13);
l_39 = IF_FALSE(l_36);
l_40 = LOOP_EXIT(l_39, l_13);
l_41 = BEGIN(l_40);
int32_t d_42 = ADD(d_29, d_3);
int32_t d_43 = ADD(d_42, d_4);
int32_t d_44 = ADD(d_43, d_30);
int32_t d_45 = ADD(d_44, d_21);
int32_t d_46 = ADD(d_45, d_31);
int32_t d_47 = ADD(d_46, d_32);
int32_t d_48 = ADD(d_47, d_33);
int32_t d_49 = ADD(d_48, d_35);
l_50 = RETURN(l_41, d_49);
int32_t d_40 = ADD(d_29, d_3);
int32_t d_41 = ADD(d_40, d_4);
int32_t d_42 = ADD(d_41, d_30);
int32_t d_43 = ADD(d_42, d_21);
int32_t d_44 = ADD(d_43, d_31);
int32_t d_45 = ADD(d_44, d_32);
int32_t d_46 = ADD(d_45, d_33);
int32_t d_47 = ADD(d_46, d_35);
l_48 = RETURN(l_39, d_47);
}
{ # CFG map (insn -> bb)
1 -> 1
@ -156,21 +152,19 @@
31 -> 5
32 -> 5
33 -> 5
34 -> 8
35 -> 8
34 -> 7
35 -> 7
36 -> 5
37 -> 6
38 -> 6
39 -> 7
40 -> 7
41 -> 8
42 -> 8
43 -> 8
44 -> 8
45 -> 8
46 -> 8
47 -> 8
48 -> 8
49 -> 8
50 -> 8
41 -> 7
42 -> 7
43 -> 7
44 -> 7
45 -> 7
46 -> 7
47 -> 7
48 -> 7
}

View File

@ -9,7 +9,7 @@
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 2;
l_1 = START(l_21);
l_1 = START(l_20);
bool d_2 = PARAM(l_1, "cond", 0);
bool d_3 = COPY(c_4);
l_4 = END(l_1);
@ -28,8 +28,7 @@
l_17 = IF_TRUE(l_16);
l_18 = LOOP_END(l_17, l_5);
l_19 = IF_FALSE(l_16);
l_20 = LOOP_EXIT(l_19, l_5);
l_21 = RETURN(l_20, d_15);
l_20 = RETURN(l_19, d_15);
}
--EXPECT--
{
@ -38,7 +37,7 @@
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 2;
l_1 = START(l_19);
l_1 = START(l_18);
bool d_2 = PARAM(l_1, "cond", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_16);
@ -55,8 +54,7 @@
l_15 = IF_TRUE(l_14);
l_16 = LOOP_END(l_15, l_4);
l_17 = IF_FALSE(l_14);
l_18 = LOOP_EXIT(l_17, l_4);
l_19 = RETURN(l_18, c_4);
l_18 = RETURN(l_17, c_4);
}
{ # Use Lists
00001(2): [00002, 00003]
@ -67,7 +65,6 @@
00015(1): [00016]
00016(1): [00004]
00017(1): [00018]
00018(1): [00019]
}
{ # CFG map (insn -> bb)
1 -> 1
@ -88,5 +85,4 @@
16 -> 3
17 -> 4
18 -> 4
19 -> 4
}

View File

@ -9,7 +9,7 @@
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 2;
l_1 = START(l_34);
l_1 = START(l_33);
bool d_2 = PARAM(l_1, "cond", 0);
bool d_3 = PARAM(l_1, "z", 1);
bool d_4 = COPY(c_4);
@ -41,8 +41,7 @@
l_30 = IF_TRUE(l_29);
l_31 = LOOP_END(l_30, l_7);
l_32 = IF_FALSE(l_29);
l_33 = LOOP_EXIT(l_32, l_7);
l_34 = RETURN(l_33, d_19);
l_33 = RETURN(l_32, d_19);
}
--EXPECT--
{
@ -51,7 +50,7 @@
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 2;
l_1 = START(l_30);
l_1 = START(l_29);
bool d_2 = PARAM(l_1, "cond", 0);
bool d_3 = PARAM(l_1, "z", 1);
l_4 = END(l_1);
@ -79,8 +78,7 @@
l_26 = IF_TRUE(l_25);
l_27 = LOOP_END(l_26, l_5);
l_28 = IF_FALSE(l_25);
l_29 = LOOP_EXIT(l_28, l_5);
l_30 = RETURN(l_29, c_4);
l_29 = RETURN(l_28, c_4);
}
{ # Use Lists
00001(3): [00002, 00003, 00004]
@ -91,7 +89,6 @@
00026(1): [00027]
00027(1): [00005]
00028(1): [00029]
00029(1): [00030]
}
{ # CFG map (insn -> bb)
1 -> 1
@ -123,5 +120,4 @@
27 -> 3
28 -> 4
29 -> 4
30 -> 4
}

View File

@ -9,7 +9,7 @@
int32_t c_5 = 2;
int32_t c_6 = 1;
int32_t c_7 = 0;
l_1 = START(l_16);
l_1 = START(l_14);
int32_t d_2 = PARAM(l_1, "x", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_12);
@ -22,9 +22,7 @@
l_11 = IF_TRUE(l_10);
l_12 = LOOP_END(l_11, l_4);
l_13 = IF_FALSE(l_10);
l_14 = LOOP_EXIT(l_13, l_4);
l_15 = BEGIN(l_14);
l_16 = RETURN(l_15, d_8);
l_14 = RETURN(l_13, d_8);
}
--EXPECT--
{
@ -34,7 +32,7 @@
int32_t c_4 = 10;
int32_t c_5 = 1;
int32_t c_6 = 0;
l_1 = START(l_16);
l_1 = START(l_14);
int32_t d_2 = PARAM(l_1, "x", 0);
int32_t d_3 = ADD(d_2, c_5);
l_4 = END(l_1);
@ -46,8 +44,6 @@
l_10 = IF_TRUE(l_9);
l_11 = LOOP_END(l_10, l_5);
l_12 = IF_FALSE(l_9);
l_13 = LOOP_EXIT(l_12, l_5);
l_14 = BEGIN(l_13);
int32_t d_15 = ADD(d_7, d_7);
l_16 = RETURN(l_14, d_15);
int32_t d_13 = ADD(d_7, d_7);
l_14 = RETURN(l_12, d_13);
}

View File

@ -9,7 +9,7 @@
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 4;
l_1 = START(l_54);
l_1 = START(l_52);
int32_t d_2 = PARAM(l_1, "a", 0);
int32_t d_3 = PARAM(l_1, "b", 1);
int32_t d_4 = PARAM(l_1, "c", 2);
@ -52,17 +52,15 @@
l_41 = IF_TRUE(l_40);
l_42 = LOOP_END(l_41, l_13);
l_43 = IF_FALSE(l_40);
l_44 = LOOP_EXIT(l_43, l_13);
l_45 = BEGIN(l_44);
int32_t d_46 = ADD(d_32, d_3);
int32_t d_47 = ADD(d_46, d_4);
int32_t d_48 = ADD(d_47, d_33);
int32_t d_49 = ADD(d_48, d_34);
int32_t d_50 = ADD(d_49, d_35);
int32_t d_51 = ADD(d_50, d_36);
int32_t d_52 = ADD(d_51, d_37);
int32_t d_53 = ADD(d_52, d_39);
l_54 = RETURN(l_45, d_53);
int32_t d_44 = ADD(d_32, d_3);
int32_t d_45 = ADD(d_44, d_4);
int32_t d_46 = ADD(d_45, d_33);
int32_t d_47 = ADD(d_46, d_34);
int32_t d_48 = ADD(d_47, d_35);
int32_t d_49 = ADD(d_48, d_36);
int32_t d_50 = ADD(d_49, d_37);
int32_t d_51 = ADD(d_50, d_39);
l_52 = RETURN(l_43, d_51);
}
--EXPECT--
{
@ -71,7 +69,7 @@
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 4;
l_1 = START(l_50);
l_1 = START(l_48);
int32_t d_2 = PARAM(l_1, "a", 0);
int32_t d_3 = PARAM(l_1, "b", 1);
int32_t d_4 = PARAM(l_1, "c", 2);
@ -108,19 +106,17 @@
l_35 = IF_TRUE(l_34);
l_36 = LOOP_END(l_35, l_15);
l_37 = IF_FALSE(l_34);
l_38 = LOOP_EXIT(l_37, l_15);
l_39 = BEGIN(l_38);
int32_t d_40 = MUL(d_29, d_3);
int32_t d_41 = ADD(d_40, c_4);
int32_t d_42 = ADD(d_29, d_3);
int32_t d_43 = ADD(d_42, d_4);
int32_t d_44 = ADD(d_43, d_30);
int32_t d_45 = ADD(d_44, d_12);
int32_t d_46 = ADD(d_45, d_31);
int32_t d_47 = ADD(d_46, d_32);
int32_t d_48 = ADD(d_47, d_33);
int32_t d_49 = ADD(d_48, d_41);
l_50 = RETURN(l_39, d_49);
int32_t d_38 = MUL(d_29, d_3);
int32_t d_39 = ADD(d_38, c_4);
int32_t d_40 = ADD(d_29, d_3);
int32_t d_41 = ADD(d_40, d_4);
int32_t d_42 = ADD(d_41, d_30);
int32_t d_43 = ADD(d_42, d_12);
int32_t d_44 = ADD(d_43, d_31);
int32_t d_45 = ADD(d_44, d_32);
int32_t d_46 = ADD(d_45, d_33);
int32_t d_47 = ADD(d_46, d_39);
l_48 = RETURN(l_37, d_47);
}
{ # CFG
BB1:
@ -178,16 +174,8 @@ BB6:
loop_depth=1
BB7:
start=37
end=38
successors(1) [BB8]
end=48
predecessors(1) [BB5]
dom_parent=BB5
dom_depth=3
dom_children [BB8]
BB8:
start=39
end=50
predecessors(1) [BB7]
dom_parent=BB7
dom_depth=4
}

View File

@ -9,7 +9,7 @@
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 2;
l_1 = START(l_21);
l_1 = START(l_20);
bool d_2 = PARAM(l_1, "cond", 0);
bool d_3 = COPY(c_4);
l_4 = END(l_1);
@ -28,8 +28,7 @@
l_17 = IF_TRUE(l_16);
l_18 = LOOP_END(l_17, l_5);
l_19 = IF_FALSE(l_16);
l_20 = LOOP_EXIT(l_19, l_5);
l_21 = RETURN(l_20, d_15);
l_20 = RETURN(l_19, d_15);
}
--EXPECT--
{
@ -37,7 +36,7 @@
bool c_2 = 0;
bool c_3 = 1;
int32_t c_4 = 1;
l_1 = START(l_10);
l_1 = START(l_9);
bool d_2 = PARAM(l_1, "cond", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_7);
@ -45,8 +44,7 @@
l_6 = IF_TRUE(l_5);
l_7 = LOOP_END(l_6, l_4);
l_8 = IF_FALSE(l_5);
l_9 = LOOP_EXIT(l_8, l_4);
l_10 = RETURN(l_9, c_4);
l_9 = RETURN(l_8, c_4);
}
{ # Use Lists
00001(2): [00002, 00003]
@ -57,5 +55,4 @@
00006(1): [00007]
00007(1): [00004]
00008(1): [00009]
00009(1): [00010]
}

View File

@ -7,7 +7,7 @@
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 2;
l_1 = START(l_34);
l_1 = START(l_33);
bool d_2 = PARAM(l_1, "cond", 0);
bool d_3 = PARAM(l_1, "z", 1);
bool d_4 = COPY(c_4);
@ -39,8 +39,7 @@
l_30 = IF_TRUE(l_29);
l_31 = LOOP_END(l_30, l_7);
l_32 = IF_FALSE(l_29);
l_33 = LOOP_EXIT(l_32, l_7);
l_34 = RETURN(l_33, d_19);
l_33 = RETURN(l_32, d_19);
}
--EXPECT--
{
@ -48,7 +47,7 @@
bool c_2 = 0;
bool c_3 = 1;
int32_t c_4 = 1;
l_1 = START(l_11);
l_1 = START(l_10);
bool d_2 = PARAM(l_1, "cond", 0);
bool d_3 = PARAM(l_1, "z", 1);
l_4 = END(l_1);
@ -57,6 +56,5 @@
l_7 = IF_TRUE(l_6);
l_8 = LOOP_END(l_7, l_5);
l_9 = IF_FALSE(l_6);
l_10 = LOOP_EXIT(l_9, l_5);
l_11 = RETURN(l_10, c_4);
l_10 = RETURN(l_9, c_4);
}

View File

@ -8,7 +8,7 @@
bool c_2 = 0;
bool c_3 = 1;
int32_t c_4 = 1;
l_1 = START(l_13);
l_1 = START(l_11);
int32_t d_2 = PARAM(l_1, "x", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_9);
@ -18,9 +18,7 @@
l_8 = IF_TRUE(l_7);
l_9 = LOOP_END(l_8, l_4);
l_10 = IF_FALSE(l_7);
l_11 = LOOP_EXIT(l_10, l_4);
l_12 = BEGIN(l_11);
l_13 = RETURN(l_12, d_5);
l_11 = RETURN(l_10, d_5);
}
--EXPECT--
{
@ -28,7 +26,7 @@
bool c_2 = 0;
bool c_3 = 1;
int32_t c_4 = 1;
l_1 = START(l_13);
l_1 = START(l_11);
int32_t d_2 = PARAM(l_1, "x", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_9);
@ -38,9 +36,7 @@
l_8 = IF_TRUE(l_7);
l_9 = LOOP_END(l_8, l_4);
l_10 = IF_FALSE(l_7);
l_11 = LOOP_EXIT(l_10, l_4);
l_12 = BEGIN(l_11);
l_13 = RETURN(l_12, d_5);
l_11 = RETURN(l_10, d_5);
}
{ # CFG
BB1:
@ -72,19 +68,11 @@ BB3:
BB4:
start=10
end=11
successors(1) [BB5]
predecessors(1) [BB2]
dom_parent=BB2
dom_depth=2
dom_children [BB5]
BB5:
start=12
end=13
predecessors(1) [BB4]
dom_parent=BB4
dom_depth=3
}
{ # LIVE-RANGES (vregs_count=2)
R1 (d_2, d_5): [2.2-8.0), [10.0-13.1), DEF(2.2), PHI_USE(3.2, phi=d_5/2), DEF(5.2), USE(6.1/1), USE(13.1/2)
R1 (d_2, d_5): [2.2-8.0), [10.0-11.1), DEF(2.2), PHI_USE(3.2, phi=d_5/2), DEF(5.2), USE(6.1/1), USE(11.1/2)
R2 (d_6): [6.2-10.0), DEF(6.2), USE(7.1/2), PHI_USE(9.2, phi=d_5/3)
}

View File

@ -8,7 +8,7 @@
bool c_2 = 0;
bool c_3 = 1;
int32_t c_4 = 1;
l_1 = START(l_13);
l_1 = START(l_11);
int32_t x1 = PARAM(l_1, "x", 0);
int32_t y1 = PARAM(l_1, "y", 1);
int32_t cond = PARAM(l_1, "z", 2);
@ -23,16 +23,14 @@
l_8 = IF_TRUE(l_7);
l_9 = LOOP_END(l_8, l_4);
l_10 = IF_FALSE(l_7);
l_11 = LOOP_EXIT(l_10, l_4);
l_12 = BEGIN(l_11);
l_13 = RETURN(l_12, z);
l_11 = RETURN(l_10, z);
}
--EXPECT--
{
uintptr_t c_1 = 0;
bool c_2 = 0;
bool c_3 = 1;
l_1 = START(l_15);
l_1 = START(l_13);
int32_t d_2 = PARAM(l_1, "x", 0);
int32_t d_3 = PARAM(l_1, "y", 1);
int32_t d_4 = PARAM(l_1, "z", 2);
@ -44,9 +42,7 @@
l_10 = IF_TRUE(l_9);
l_11 = LOOP_END(l_10, l_6);
l_12 = IF_FALSE(l_9);
l_13 = LOOP_EXIT(l_12, l_6);
l_14 = BEGIN(l_13);
l_15 = RETURN(l_14, d_7);
l_13 = RETURN(l_12, d_7);
}
{ # CFG
BB1:
@ -80,20 +76,12 @@ BB3:
BB4:
start=12
end=13
successors(1) [BB5]
predecessors(1) [BB2]
dom_parent=BB2
dom_depth=2
dom_children [BB5]
BB5:
start=14
end=15
predecessors(1) [BB4]
dom_parent=BB4
dom_depth=3
}
{ # LIVE-RANGES (vregs_count=3)
R1 (d_2, d_7): [2.2-15.1), DEF(2.2), PHI_USE(5.2, phi=d_7/2), DEF(7.2), PHI_USE(11.2, phi=d_8/3), USE(15.1/2)
R1 (d_2, d_7): [2.2-13.1), DEF(2.2), PHI_USE(5.2, phi=d_7/2), DEF(7.2), PHI_USE(11.2, phi=d_8/3), USE(13.1/2)
R2 (d_3, d_8): [3.2-12.0), DEF(3.2), PHI_USE(5.2, phi=d_8/2), DEF(8.2), PHI_USE(11.2, phi=d_7/3)
R3 (d_4): [4.2-12.0), DEF(4.2), USE(9.1/2)
}

View File

@ -9,7 +9,7 @@
int32_t c_5 = 2;
int32_t c_6 = 1;
int32_t c_7 = 0;
l_1 = START(l_16);
l_1 = START(l_14);
int32_t d_2 = PARAM(l_1, "x", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_12);
@ -23,9 +23,7 @@
l_11 = IF_TRUE(l_10);
l_12 = LOOP_END(l_11, l_4);
l_13 = IF_FALSE(l_10);
l_14 = LOOP_EXIT(l_13, l_4);
l_15 = BEGIN(l_14);
l_16 = RETURN(l_15, d_8);
l_14 = RETURN(l_13, d_8);
}
--EXPECT--
{
@ -35,7 +33,7 @@
int32_t c_4 = 10;
int32_t c_5 = 1;
int32_t c_6 = 0;
l_1 = START(l_16);
l_1 = START(l_14);
int32_t d_2 = PARAM(l_1, "x", 0);
int32_t d_3 = ADD(d_2, c_5);
l_4 = END(l_1);
@ -47,8 +45,6 @@
l_10 = IF_TRUE(l_9);
l_11 = LOOP_END(l_10, l_5);
l_12 = IF_FALSE(l_9);
l_13 = LOOP_EXIT(l_12, l_5);
l_14 = BEGIN(l_13);
int32_t d_15 = ADD(d_7, d_7);
l_16 = RETURN(l_14, d_15);
int32_t d_13 = ADD(d_7, d_7);
l_14 = RETURN(l_12, d_13);
}

View File

@ -37,9 +37,8 @@
l_24 = IF_TRUE(l_23);
l_25 = LOOP_END(l_24, l_13);
l_26 = IF_FALSE(l_23);
l_27 = LOOP_EXIT(l_26, l_13);
bool d_28 = EQ(d_22, c_4);
l_29 = IF(l_27, d_28);
l_29 = IF(l_26, d_28);
l_30 = IF_TRUE(l_29);
l_31 = RETURN(l_30, d_22);
l_32 = IF_FALSE(l_29);
@ -57,7 +56,7 @@
int32_t c_5 = 2;
int32_t c_6 = 3;
int32_t c_7 = 4;
l_1 = START(l_38);
l_1 = START(l_37);
int32_t d_2 = PARAM(l_1, "z", 0);
bool d_3 = PARAM(l_1, "cond", 1);
l_4 = SWITCH(l_1, d_2);
@ -83,15 +82,14 @@
l_24 = IF_TRUE(l_23);
l_25 = LOOP_END(l_24, l_13);
l_26 = IF_FALSE(l_23);
l_27 = LOOP_EXIT(l_26, l_13);
NOP;
NOP;
NOP;
l_31 = RETURN(l_27, c_4);
l_30 = RETURN(l_26, c_4);
NOP;
NOP;
l_34 = MERGE/3(l_6, l_8, l_10);
l_33 = MERGE/3(l_6, l_8, l_10);
NOP;
int32_t d_36 = PHI/3(l_34, c_4, c_5, c_6);
l_38 = RETURN(l_34, d_36, l_31);
int32_t d_35 = PHI/3(l_33, c_4, c_5, c_6);
l_37 = RETURN(l_33, d_35, l_30);
}

View File

@ -8,7 +8,7 @@ DESSA 002
bool c_2 = 0;
bool c_3 = 1;
int32_t c_4 = 1;
l_1 = START(l_13);
l_1 = START(l_11);
int32_t d_2 = PARAM(l_1, "x", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_9);
@ -18,9 +18,7 @@ DESSA 002
l_8 = IF_TRUE(l_7);
l_9 = LOOP_END(l_8, l_4);
l_10 = IF_FALSE(l_7);
l_11 = LOOP_EXIT(l_10, l_4);
l_12 = BEGIN(l_11);
l_13 = RETURN(l_12, d_5);
l_11 = RETURN(l_10, d_5);
}
--EXPECT--
int32_t test(int32_t x)
@ -29,9 +27,9 @@ int32_t test(int32_t x)
int32_t d_2;
bb2:
d_2 = d_1 + 1;
if (!d_2) goto bb5;
if (!d_2) goto bb4;
d_1 = d_2;
goto bb2;
bb5:
bb4:
return d_1;
}

View File

@ -10,7 +10,7 @@ DESSA 003
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_12 = 12;
l_1 = START(l_13);
l_1 = START(l_11);
int32_t x0 = PARAM(l_1, "x", 0);
int32_t y1 = PARAM(l_1, "y", 1);
int32_t cond = PARAM(l_1, "z", 2);
@ -26,9 +26,7 @@ DESSA 003
l_8 = IF_TRUE(l_7);
l_9 = LOOP_END(l_8, l_4);
l_10 = IF_FALSE(l_7);
l_11 = LOOP_EXIT(l_10, l_4);
l_12 = BEGIN(l_11);
l_13 = RETURN(l_12, z);
l_11 = RETURN(l_10, z);
}
--EXPECT--
int32_t test(int32_t x, int32_t y, int32_t z)
@ -39,11 +37,11 @@ int32_t test(int32_t x, int32_t y, int32_t z)
int32_t d_4;
d_4 = d_1 / 12;
bb2:
if (!d_3) goto bb5;
if (!d_3) goto bb4;
tmp = d_4;
d_4 = d_2;
d_2 = tmp;
goto bb2;
bb5:
bb4:
return d_4;
}

View File

@ -13,7 +13,7 @@ x86_64
bool c_3 = 1;
int32_t i_1 = 1;
int32_t i_2 = 2;
ll_1 = START(ll_16);
ll_1 = START(ll_14);
bool cond = PARAM(ll_1, "cond", 0);
int32_t x_0 = COPY(i_1);
ll_2 = END(ll_1);
@ -32,8 +32,7 @@ x86_64
ll_11 = IF_TRUE(ll_10);
ll_12 = LOOP_END(ll_11, ll_3);
ll_13 = IF_FALSE(ll_10);
ll_14 = LOOP_EXIT(ll_13, ll_3);
ll_16 = RETURN(ll_14, x_3);
ll_14 = RETURN(ll_13, x_3);
}
--EXPECT--
test:

View File

@ -12,7 +12,7 @@ x86_64
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 2;
l_1 = START(l_34);
l_1 = START(l_33);
bool d_2 = PARAM(l_1, "cond", 0);
bool d_3 = PARAM(l_1, "z", 1);
bool d_4 = COPY(c_4);
@ -44,8 +44,7 @@ x86_64
l_30 = IF_TRUE(l_29);
l_31 = LOOP_END(l_30, l_7);
l_32 = IF_FALSE(l_29);
l_33 = LOOP_EXIT(l_32, l_7);
l_34 = RETURN(l_33, d_19);
l_33 = RETURN(l_32, d_19);
}
--EXPECT--
test:

View File

@ -43,9 +43,8 @@ x86_64
l_30 = IF_TRUE(l_29);
l_31 = LOOP_END(l_30, l_7);
l_32 = IF_FALSE(l_29);
l_33 = LOOP_EXIT(l_32, l_7);
int32_t xx = MUL(d_19, d_28);
l_34 = RETURN(l_33, xx);
l_34 = RETURN(l_32, xx);
}
--EXPECT--
test:

View File

@ -32,10 +32,9 @@ x86_64
ll_11 = IF_TRUE(ll_10);
ll_12 = LOOP_END(ll_11, ll_3);
ll_13 = IF_FALSE(ll_10);
ll_14 = LOOP_EXIT(ll_13, ll_3);
int32_t xx = MUL(x_3, i_2);
int32_t yy = MUL(xx, ret);
ll_16 = RETURN(ll_14, yy);
ll_16 = RETURN(ll_13, yy);
}
--EXPECT--
test:

View File

@ -13,7 +13,7 @@ x86_64
int32_t c_5 = 2;
int32_t c_6 = 1;
int32_t c_7 = 0;
l_1 = START(l_16);
l_1 = START(l_14);
int32_t d_2 = PARAM(l_1, "x", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_12);
@ -27,9 +27,7 @@ x86_64
l_11 = IF_TRUE(l_10);
l_12 = LOOP_END(l_11, l_4);
l_13 = IF_FALSE(l_10);
l_14 = LOOP_EXIT(l_13, l_4);
l_15 = BEGIN(l_14);
l_16 = RETURN(l_15, d_8);
l_14 = RETURN(l_13, d_8);
}
--EXPECT--
test:

View File

@ -10,7 +10,7 @@ x86_64
bool c_2 = 0;
bool c_3 = 1;
int32_t c_4 = 1;
l_1 = START(l_13);
l_1 = START(l_11);
int32_t d_2 = PARAM(l_1, "x", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_9);
@ -20,9 +20,7 @@ x86_64
l_8 = IF_TRUE(l_7);
l_9 = LOOP_END(l_8, l_4);
l_10 = IF_FALSE(l_7);
l_11 = LOOP_EXIT(l_10, l_4);
l_12 = BEGIN(l_11);
l_13 = RETURN(l_12, d_5);
l_11 = RETURN(l_10, d_5);
}
--EXPECT--
test:

View File

@ -12,7 +12,7 @@ x86_64
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_12 = 12;
l_1 = START(l_13);
l_1 = START(l_11);
int32_t x0 = PARAM(l_1, "x", 0);
int32_t y1 = PARAM(l_1, "y", 1);
int32_t cond = PARAM(l_1, "z", 2);
@ -28,9 +28,7 @@ x86_64
l_8 = IF_TRUE(l_7);
l_9 = LOOP_END(l_8, l_4);
l_10 = IF_FALSE(l_7);
l_11 = LOOP_EXIT(l_10, l_4);
l_12 = BEGIN(l_11);
l_13 = RETURN(l_12, z);
l_11 = RETURN(l_10, z);
}
--EXPECT--
test:

View File

@ -54,8 +54,6 @@ x86_64
ll_11 = IF_TRUE(ll_10);
ll_12 = LOOP_END(ll_11, ll_3);
ll_13 = IF_FALSE(ll_10);
ll_14 = LOOP_EXIT(ll_13, ll_3);
ll_15 = BEGIN(ll_14);
int32_t ret1 = ADD(a_3, b_0);
int32_t ret2 = ADD(ret1, c_0);
int32_t ret3 = ADD(ret2, d_3);
@ -64,7 +62,7 @@ x86_64
int32_t ret6 = ADD(ret5, s_3);
int32_t ret7 = ADD(ret6, t_3);
int32_t ret8 = ADD(ret7, y_0);
ll_16 = RETURN(ll_15, ret8);
ll_16 = RETURN(ll_13, ret8);
}
--EXPECT--
test:

View File

@ -54,8 +54,6 @@ x86_64
ll_11 = IF_TRUE(ll_10);
ll_12 = LOOP_END(ll_11, ll_3);
ll_13 = IF_FALSE(ll_10);
ll_14 = LOOP_EXIT(ll_13, ll_3);
ll_15 = BEGIN(ll_14);
int32_t ret1 = ADD(a_3, b_0);
int32_t ret2 = ADD(ret1, c_0);
int32_t ret3 = ADD(ret2, d_3);
@ -64,7 +62,7 @@ x86_64
int32_t ret6 = ADD(ret5, s_3);
int32_t ret7 = ADD(ret6, t_3);
int32_t ret8 = ADD(ret7, y_0);
ll_16 = RETURN(ll_15, ret8);
ll_16 = RETURN(ll_13, ret8);
}
--EXPECT--
test:

View File

@ -13,7 +13,7 @@ x86_64
int32_t c_5 = 2;
int32_t c_6 = 1;
int32_t c_7 = 0;
l_1 = START(l_16);
l_1 = START(l_14);
int32_t d_2 = PARAM(l_1, "x", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_12);
@ -26,9 +26,7 @@ x86_64
l_11 = IF_TRUE(l_10);
l_12 = LOOP_END(l_11, l_4);
l_13 = IF_FALSE(l_10);
l_14 = LOOP_EXIT(l_13, l_4);
l_15 = BEGIN(l_14);
l_16 = RETURN(l_15, d_8);
l_14 = RETURN(l_13, d_8);
}
--EXPECT--
test:

View File

@ -39,14 +39,10 @@ x86_64
int32_t d_25 = ADD(d_11, c_5);
l_26 = LOOP_END(l_23, l_10);
l_27 = IF_FALSE(l_14);
l_28 = LOOP_EXIT(l_27, l_10);
int32_t d_29 = ADD(d_4, c_5);
l_30 = LOOP_END(l_28, l_3);
l_30 = LOOP_END(l_27, l_3);
l_31 = IF_FALSE(l_7);
l_32 = LOOP_EXIT(l_31, l_3);
l_33 = END(l_32);
l_34 = BEGIN(l_33);
l_35 = RETURN(l_34, d_5);
l_35 = RETURN(l_31, d_5);
}
--EXPECT--
test:

View File

@ -39,9 +39,8 @@ x86_64
l_24 = IF_TRUE(l_23);
l_25 = LOOP_END(l_24, l_13);
l_26 = IF_FALSE(l_23);
l_27 = LOOP_EXIT(l_26, l_13);
bool d_28 = EQ(d_22, c_4);
l_29 = IF(l_27, d_28);
l_29 = IF(l_26, d_28);
l_30 = IF_TRUE(l_29);
l_31 = RETURN(l_30, d_22);
l_32 = IF_FALSE(l_29);