ir/tests/010.irt

89 lines
1.4 KiB
Plaintext

--TEST--
010: SCCP (Figure 3.9 from "Combining Analyses, Combining Optimization" by C.Click)
--ARGS--
--dump-use-lists --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 = 2;
l_1 = START(l_20);
bool d_2 = PARAM(l_1, "cond", 0);
int32_t d_3 = COPY(c_4);
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);
int32_t d_10 = COPY(c_5);
l_11 = END(l_9);
l_12 = IF_FALSE(l_8);
l_13 = END(l_12);
l_14 = MERGE(l_11, l_13);
int32_t d_15 = PHI(l_14, d_10, d_6);
l_16 = IF(l_14, d_2);
l_17 = IF_TRUE(l_16);
l_18 = LOOP_END(l_17);
l_19 = IF_FALSE(l_16);
l_20 = RETURN(l_19, d_15);
}
--EXPECT--
{
uintptr_t c_1 = 0;
bool c_2 = 0;
bool c_3 = 1;
int32_t c_4 = 1;
int32_t c_5 = 2;
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);
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);
l_17 = IF_FALSE(l_14);
l_18 = RETURN(l_17, c_4);
}
{ # 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]
}
{ # CFG map (insn -> bb)
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
}