mirror of
https://github.com/danog/ir.git
synced 2024-11-26 20:34:53 +01:00
171 lines
3.8 KiB
Plaintext
171 lines
3.8 KiB
Plaintext
--TEST--
|
|
009: GCM for a larger loop (Figure 9 from "Global Code Motion Global Value Numbering" by Cliff Click)
|
|
--ARGS--
|
|
--dump-cfg-map --save --dump-after-gcm
|
|
--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_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);
|
|
l_12 = END(l_1);
|
|
l_13 = LOOP_BEGIN(l_12, l_38);
|
|
int32_t d_14 = PHI(l_13, d_2, d_29);
|
|
int32_t d_15 = PHI(l_13, d_5, d_30);
|
|
int32_t d_16 = PHI(l_13, d_7, d_31);
|
|
int32_t d_17 = PHI(l_13, d_8, d_32);
|
|
int32_t d_18 = PHI(l_13, d_9, d_33);
|
|
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);
|
|
l_23 = END(l_20);
|
|
l_24 = IF_FALSE(l_19);
|
|
int32_t d_25 = MUL(d_14, 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_14);
|
|
int32_t d_30 = PHI(l_28, d_15, d_4);
|
|
int32_t d_31 = PHI(l_28, d_22, d_16);
|
|
int32_t d_32 = PHI(l_28, d_17, d_25);
|
|
int32_t d_33 = PHI(l_28, d_18, d_26);
|
|
int32_t d_34 = MUL(d_29, d_3);
|
|
int32_t d_35 = ADD(d_34, c_4);
|
|
l_36 = IF(l_28, d_11);
|
|
l_37 = IF_TRUE(l_36);
|
|
l_38 = LOOP_END(l_37);
|
|
l_39 = IF_FALSE(l_36);
|
|
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
|
|
2 -> 1
|
|
3 -> 1
|
|
4 -> 1
|
|
5 -> 1
|
|
6 -> 1
|
|
7 -> 1
|
|
8 -> 1
|
|
9 -> 1
|
|
10 -> 1
|
|
11 -> 1
|
|
12 -> 1
|
|
13 -> 2
|
|
14 -> 2
|
|
15 -> 2
|
|
16 -> 2
|
|
17 -> 2
|
|
18 -> 2
|
|
19 -> 2
|
|
20 -> 3
|
|
21 -> 1
|
|
22 -> 1
|
|
23 -> 3
|
|
24 -> 4
|
|
25 -> 4
|
|
26 -> 4
|
|
27 -> 4
|
|
28 -> 5
|
|
29 -> 5
|
|
30 -> 5
|
|
31 -> 5
|
|
32 -> 5
|
|
33 -> 5
|
|
34 -> 7
|
|
35 -> 7
|
|
36 -> 5
|
|
37 -> 6
|
|
38 -> 6
|
|
39 -> 7
|
|
40 -> 7
|
|
41 -> 7
|
|
42 -> 7
|
|
43 -> 7
|
|
44 -> 7
|
|
45 -> 7
|
|
46 -> 7
|
|
47 -> 7
|
|
48 -> 7
|
|
}
|