ir/tests/014.irt

50 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2022-04-05 23:19:23 +02:00
--TEST--
014: Schedule for simple loop (Figure 7 from "Global Code Motion Global Value Numbering" by Cliff Click)
--CODE--
{
uintptr_t c_1 = 0;
bool c_2 = 0;
bool c_3 = 1;
int32_t c_4 = 10;
int32_t c_5 = 2;
int32_t c_6 = 1;
int32_t c_7 = 0;
2022-06-15 16:27:31 +02:00
l_1 = START(l_14);
2022-04-05 23:19:23 +02:00
int32_t d_2 = PARAM(l_1, "x", 0);
l_3 = END(l_1);
l_4 = LOOP_BEGIN(l_3, l_12);
int32_t d_5 = PHI(l_4, c_7, d_7);
int32_t d_6 = ADD(d_2, c_6);
int32_t d_7 = ADD(d_6, d_5);
int32_t d_8 = MUL(d_7, c_5);
bool d_9 = LT(d_7, c_4);
l_10 = IF(l_4, d_9);
l_11 = IF_TRUE(l_10);
l_12 = LOOP_END(l_11);
2022-04-05 23:19:23 +02:00
l_13 = IF_FALSE(l_10);
2022-06-15 16:27:31 +02:00
l_14 = RETURN(l_13, d_8);
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 = 10;
int32_t c_5 = 1;
int32_t c_6 = 0;
2022-06-15 16:27:31 +02:00
l_1 = START(l_14);
2022-04-05 23:19:23 +02:00
int32_t d_2 = PARAM(l_1, "x", 0);
int32_t d_3 = ADD(d_2, c_5);
l_4 = END(l_1);
l_5 = LOOP_BEGIN(l_4, l_11);
int32_t d_6 = PHI(l_5, c_6, d_7);
int32_t d_7 = ADD(d_3, d_6);
bool d_8 = LT(d_7, c_4);
l_9 = IF(l_5, d_8);
l_10 = IF_TRUE(l_9);
l_11 = LOOP_END(l_10);
2022-04-05 23:19:23 +02:00
l_12 = IF_FALSE(l_9);
2022-06-15 16:27:31 +02:00
int32_t d_13 = ADD(d_7, d_7);
l_14 = RETURN(l_12, d_13);
2022-04-05 23:19:23 +02:00
}