mirror of
https://github.com/danog/ir.git
synced 2024-12-02 17:55:40 +01:00
38 lines
618 B
Plaintext
38 lines
618 B
Plaintext
|
--TEST--
|
||
|
DESSA 002
|
||
|
--ARGS--
|
||
|
--emit-llvm
|
||
|
--CODE--
|
||
|
{
|
||
|
uintptr_t c_1 = 0;
|
||
|
bool c_2 = 0;
|
||
|
bool c_3 = 1;
|
||
|
int32_t c_4 = 1;
|
||
|
l_1 = START(l_11);
|
||
|
int32_t d_2 = PARAM(l_1, "x", 0);
|
||
|
l_3 = END(l_1);
|
||
|
l_4 = LOOP_BEGIN(l_3, l_9);
|
||
|
int32_t d_5 = PHI(l_4, d_2, d_6);
|
||
|
int32_t d_6 = ADD(d_5, c_4);
|
||
|
l_7 = IF(l_4, d_6);
|
||
|
l_8 = IF_TRUE(l_7);
|
||
|
l_9 = LOOP_END(l_8);
|
||
|
l_10 = IF_FALSE(l_7);
|
||
|
l_11 = RETURN(l_10, d_5);
|
||
|
}
|
||
|
--EXPECT--
|
||
|
define i32 @test(i32 %d2)
|
||
|
{
|
||
|
l1:
|
||
|
br label %l2
|
||
|
l2:
|
||
|
%d5 = phi i32 [%d2, %l1], [%d6, %l3]
|
||
|
%d6 = add i32 %d5, 1
|
||
|
%t7 = icmp ne i32 %d6, 0
|
||
|
br i1 %t7, label %l3, label %l4
|
||
|
l3:
|
||
|
br label %l2
|
||
|
l4:
|
||
|
ret i32 %d5
|
||
|
}
|