ir/tests/015.irt
2022-06-15 17:27:31 +03:00

182 lines
4.3 KiB
Plaintext

--TEST--
015: Schedule for a larger loop (Figure 9 from "Global Code Motion Global Value Numbering" by Cliff Click)
--ARGS--
--dump-cfg --save --dump-after-schedule
--CODE--
{
uintptr_t c_1 = 0;
bool c_2 = 0;
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 4;
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);
int32_t d_5 = PARAM(l_1, "d", 3);
int32_t d_6 = PARAM(l_1, "l", 4);
int32_t d_7 = PARAM(l_1, "m", 5);
int32_t d_8 = PARAM(l_1, "s", 6);
int32_t d_9 = PARAM(l_1, "t", 7);
int32_t d_10 = PARAM(l_1, "cond1", 8);
int32_t d_11 = PARAM(l_1, "cond2", 9);
l_12 = END(l_1);
l_13 = LOOP_BEGIN(l_12, l_42);
int32_t d_14 = PHI(l_13, d_2, d_32);
int32_t d_15 = PHI(l_13, d_5, d_33);
int32_t d_16 = PHI(l_13, d_7, d_35);
int32_t d_17 = PHI(l_13, d_8, d_36);
int32_t d_18 = PHI(l_13, d_9, d_37);
l_19 = IF(l_13, d_10);
l_20 = IF_TRUE(l_19);
int32_t d_21 = MUL(d_4, d_3);
int32_t d_22 = ADD(d_21, c_5);
int32_t d_23 = COPY(d_4);
l_24 = END(l_20);
l_25 = IF_FALSE(l_19);
int32_t d_26 = COPY(d_4);
int32_t d_27 = MUL(d_26, d_3);
int32_t d_28 = MUL(d_14, d_3);
int32_t d_29 = ADD(d_28, c_4);
l_30 = END(l_25);
l_31 = MERGE(l_24, l_30);
int32_t d_32 = PHI(l_31, d_23, d_14);
int32_t d_33 = PHI(l_31, d_15, d_26);
int32_t d_34 = PHI(l_31, d_21, d_27);
int32_t d_35 = PHI(l_31, d_22, d_16);
int32_t d_36 = PHI(l_31, d_17, d_28);
int32_t d_37 = PHI(l_31, d_18, d_29);
int32_t d_38 = MUL(d_32, d_3);
int32_t d_39 = ADD(d_38, c_4);
l_40 = IF(l_31, d_11);
l_41 = IF_TRUE(l_40);
l_42 = LOOP_END(l_41, l_13);
l_43 = IF_FALSE(l_40);
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--
{
uintptr_t c_1 = 0;
bool c_2 = 0;
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 4;
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);
int32_t d_5 = PARAM(l_1, "d", 3);
int32_t d_6 = PARAM(l_1, "l", 4);
int32_t d_7 = PARAM(l_1, "m", 5);
int32_t d_8 = PARAM(l_1, "s", 6);
int32_t d_9 = PARAM(l_1, "t", 7);
int32_t d_10 = PARAM(l_1, "cond1", 8);
int32_t d_11 = PARAM(l_1, "cond2", 9);
int32_t d_12 = MUL(d_4, d_3);
int32_t d_13 = ADD(d_12, c_5);
l_14 = END(l_1);
l_15 = LOOP_BEGIN(l_14, l_36);
int32_t d_16 = PHI(l_15, d_2, d_29);
int32_t d_17 = PHI(l_15, d_5, d_30);
int32_t d_18 = PHI(l_15, d_7, d_31);
int32_t d_19 = PHI(l_15, d_8, d_32);
int32_t d_20 = PHI(l_15, d_9, d_33);
l_21 = IF(l_15, d_10);
l_22 = IF_TRUE(l_21);
l_23 = END(l_22);
l_24 = IF_FALSE(l_21);
int32_t d_25 = MUL(d_16, d_3);
int32_t d_26 = ADD(d_25, c_4);
l_27 = END(l_24);
l_28 = MERGE(l_23, l_27);
int32_t d_29 = PHI(l_28, d_4, d_16);
int32_t d_30 = PHI(l_28, d_17, d_4);
int32_t d_31 = PHI(l_28, d_13, d_18);
int32_t d_32 = PHI(l_28, d_19, d_25);
int32_t d_33 = PHI(l_28, d_20, d_26);
l_34 = IF(l_28, d_11);
l_35 = IF_TRUE(l_34);
l_36 = LOOP_END(l_35, l_15);
l_37 = IF_FALSE(l_34);
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:
start=1
end=14
successors(1) [BB2]
dom_depth=0
dom_children [BB2]
BB2:
start=15
end=21
successors(2) [BB3, BB4]
predecessors(2) [BB1, BB6]
dom_parent=BB1
dom_depth=1
dom_children [BB3, BB4, BB5]
LOOP_HEADER
loop_depth=1
BB3:
start=22
end=23
successors(1) [BB5]
predecessors(1) [BB2]
dom_parent=BB2
dom_depth=2
loop_header=BB2
loop_depth=1
BB4:
start=24
end=27
successors(1) [BB5]
predecessors(1) [BB2]
dom_parent=BB2
dom_depth=2
loop_header=BB2
loop_depth=1
BB5:
start=28
end=34
successors(2) [BB6, BB7]
predecessors(2) [BB3, BB4]
dom_parent=BB2
dom_depth=2
dom_children [BB6, BB7]
loop_header=BB2
loop_depth=1
BB6:
start=35
end=36
successors(1) [BB2]
predecessors(1) [BB5]
dom_parent=BB5
dom_depth=3
loop_header=BB2
loop_depth=1
BB7:
start=37
end=48
predecessors(1) [BB5]
dom_parent=BB5
dom_depth=3
}