mirror of
https://github.com/danog/ir.git
synced 2024-11-27 04:45:38 +01:00
93 lines
1.5 KiB
Plaintext
93 lines
1.5 KiB
Plaintext
--TEST--
|
|
010: SCCP (Figure 3.9 from "Combining Analyses, Combining Optimization" by C.Click)
|
|
--ARGS--
|
|
--dump-use-lists --dump-gcm --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_21);
|
|
bool d_2 = PARAM(l_1, "cond", 0);
|
|
bool 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);
|
|
uint32_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);
|
|
uint32_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_5);
|
|
l_19 = IF_FALSE(l_16);
|
|
l_20 = LOOP_EXIT(l_19, l_5);
|
|
l_21 = RETURN(l_20, 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_19);
|
|
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_4);
|
|
l_17 = IF_FALSE(l_14);
|
|
l_18 = LOOP_EXIT(l_17, l_4);
|
|
l_19 = RETURN(l_18, 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]
|
|
00018(1): [00019]
|
|
}
|
|
{ # GCM
|
|
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
|
|
19 -> 4
|
|
}
|