Files
c3c/test/test_suite/assert/unreachable.c3t

37 lines
527 B
C

fn int foo()
{
return 1;
}
fn void test()
{
int x = foo();
if (x > 0) return;
@unreachable();
x++;
}
// #expect: unreachable.ll
%x = alloca i32
%0 = call i32 @unreachable.foo()
store i32 %0, i32* %x
%1 = load i32, i32* %x
%gt = icmp sgt i32 %1, 0
br i1 %gt, label %if.then, label %if.exit
if.then:
ret void
if.exit:
call void @llvm.trap()
unreachable
unreachable_block:
%2 = load i32, i32* %x
%add = add i32 %2, 1
store i32 %add, i32* %x
ret void