mirror of
https://github.com/danog/ir.git
synced 2024-12-02 17:55:40 +01:00
48 lines
986 B
Plaintext
48 lines
986 B
Plaintext
|
--TEST--
|
||
|
Combo 004
|
||
|
--ARGS--
|
||
|
-S
|
||
|
--CODE--
|
||
|
# Figure 3.9 from "Combining Analyses, Combining Optimization" by C.Click
|
||
|
{
|
||
|
uintptr_t c_1 = 0;
|
||
|
bool c_2 = 0;
|
||
|
bool c_3 = 1;
|
||
|
int32_t i_1 = 1;
|
||
|
int32_t i_2 = 2;
|
||
|
ll_1 = START(ll_16);
|
||
|
bool cond = PARAM(ll_1, "cond", 0);
|
||
|
int32_t ret = PARAM(ll_1, "ret", 1);
|
||
|
int32_t x_0 = COPY(i_1);
|
||
|
ll_2 = END(ll_1);
|
||
|
ll_3 = LOOP_BEGIN(ll_2, ll_12);
|
||
|
int32_t x_1 = PHI(ll_3, x_0, x_3);
|
||
|
bool b = NE(x_1, i_1);
|
||
|
ll_4 = IF(ll_3, b);
|
||
|
ll_5 = IF_TRUE(ll_4);
|
||
|
uint32_t x_2 = COPY(i_2);
|
||
|
ll_6 = END(ll_5);
|
||
|
ll_7 = IF_FALSE(ll_4);
|
||
|
ll_72 = END(ll_7);
|
||
|
ll_8 = MERGE(ll_6, ll_72);
|
||
|
uint32_t x_3 = PHI(ll_8, x_2, x_1);
|
||
|
ll_10 = IF(ll_8, cond);
|
||
|
ll_11 = IF_TRUE(ll_10);
|
||
|
ll_12 = LOOP_END(ll_11, ll_3);
|
||
|
ll_13 = IF_FALSE(ll_10);
|
||
|
ll_14 = LOOP_EXIT(ll_13, ll_3);
|
||
|
int32_t xx = MUL(x_3, i_2);
|
||
|
int32_t yy = MUL(xx, ret);
|
||
|
ll_16 = RETURN(ll_14, yy);
|
||
|
}
|
||
|
--EXPECT--
|
||
|
test:
|
||
|
movl $2, %eax
|
||
|
imull %esi, %eax
|
||
|
.L1:
|
||
|
testb %dil, %dil
|
||
|
je .L2
|
||
|
jmp .L1
|
||
|
.L2:
|
||
|
retq
|