ir/tests/010.irt

89 lines
1.4 KiB
Plaintext
Raw Normal View History

2022-04-05 23:19:23 +02:00
--TEST--
010: SCCP (Figure 3.9 from "Combining Analyses, Combining Optimization" by C.Click)
--ARGS--
2022-05-25 08:33:47 +02:00
--dump-use-lists --dump-cfg-map --save --dump-after-gcm
2022-04-05 23:19:23 +02:00
--CODE--
{
uintptr_t c_1 = 0;
bool c_2 = 0;
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 2;
2022-06-15 16:27:31 +02:00
l_1 = START(l_20);
2022-04-05 23:19:23 +02:00
bool d_2 = PARAM(l_1, "cond", 0);
int32_t d_3 = COPY(c_4);
2022-04-05 23:19:23 +02:00
l_4 = END(l_1);
l_5 = LOOP_BEGIN(l_4, l_18);
int32_t d_6 = PHI(l_5, d_3, d_15);
bool d_7 = NE(d_6, c_4);
l_8 = IF(l_5, d_7);
l_9 = IF_TRUE(l_8);
2022-09-02 08:50:38 +02:00
int32_t d_10 = COPY(c_5);
2022-04-05 23:19:23 +02:00
l_11 = END(l_9);
l_12 = IF_FALSE(l_8);
l_13 = END(l_12);
l_14 = MERGE(l_11, l_13);
2022-09-02 08:50:38 +02:00
int32_t d_15 = PHI(l_14, d_10, d_6);
2022-04-05 23:19:23 +02:00
l_16 = IF(l_14, d_2);
l_17 = IF_TRUE(l_16);
l_18 = LOOP_END(l_17);
2022-04-05 23:19:23 +02:00
l_19 = IF_FALSE(l_16);
2022-06-15 16:27:31 +02:00
l_20 = RETURN(l_19, d_15);
2022-04-05 23:19:23 +02:00
}
--EXPECT--
{
uintptr_t c_1 = 0;
bool c_2 = 0;
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 2;
2022-06-15 16:27:31 +02:00
l_1 = START(l_18);
2022-04-05 23:19:23 +02:00
bool d_2 = PARAM(l_1, "cond", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_16);
NOP;
NOP;
NOP;
NOP;
NOP;
NOP;
NOP;
NOP;
NOP;
l_14 = IF(l_4, d_2);
l_15 = IF_TRUE(l_14);
l_16 = LOOP_END(l_15);
2022-04-05 23:19:23 +02:00
l_17 = IF_FALSE(l_14);
2022-06-15 16:27:31 +02:00
l_18 = RETURN(l_17, c_4);
2022-04-05 23:19:23 +02:00
}
{ # Use Lists
00001(2): [00002, 00003]
00002(1): [00014]
00003(1): [00004]
00004(1): [00014]
00014(2): [00015, 00017]
00015(1): [00016]
00016(1): [00004]
00017(1): [00018]
}
2022-05-25 08:33:47 +02:00
{ # CFG map (insn -> bb)
2022-04-05 23:19:23 +02:00
1 -> 1
2 -> 1
3 -> 1
4 -> 2
5 -> 0
6 -> 0
7 -> 0
8 -> 0
9 -> 0
10 -> 0
11 -> 0
12 -> 0
13 -> 0
14 -> 2
15 -> 3
16 -> 3
17 -> 4
18 -> 4
}