mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
61 lines
1.2 KiB
Plaintext
61 lines
1.2 KiB
Plaintext
// #target: macos-x64
|
|
module test;
|
|
|
|
fn void? foo()
|
|
{}
|
|
|
|
faultdef AAA;
|
|
|
|
macro int? bar()
|
|
{
|
|
return AAA~;
|
|
}
|
|
|
|
fn int? baz()
|
|
{
|
|
return 2;
|
|
}
|
|
|
|
fn int main()
|
|
{
|
|
int x;
|
|
int? y;
|
|
(void)x;
|
|
(void)y;
|
|
(void)foo();
|
|
(void)bar();
|
|
(void)(bar() + 1);
|
|
(void)baz();
|
|
(void)(baz() + 1);
|
|
return 1;
|
|
}
|
|
|
|
/* #expect: test.ll
|
|
|
|
define i32 @main() #0 {
|
|
entry:
|
|
%x = alloca i32, align 4
|
|
%y = alloca i32, align 4
|
|
%y.f = alloca i64, align 8
|
|
%retparam = alloca i32, align 4
|
|
%retparam2 = alloca i32, align 4
|
|
store i32 0, ptr %x, align 4
|
|
store i64 0, ptr %y.f, align 8
|
|
store i32 0, ptr %y, align 4
|
|
%0 = call i64 @test.foo()
|
|
br label %postfailed
|
|
postfailed: ; preds = %entry
|
|
br label %postfailed1
|
|
postfailed1: ; preds = %postfailed
|
|
%1 = call i64 @test.baz(ptr %retparam)
|
|
%2 = call i64 @test.baz(ptr %retparam2)
|
|
%not_err = icmp eq i64 %2, 0
|
|
%3 = call i1 @llvm.expect.i1(i1 %not_err, i1 true)
|
|
br i1 %3, label %after_check, label %voiderr
|
|
after_check: ; preds = %postfailed1
|
|
%4 = load i32, ptr %retparam2, align 4
|
|
%add = add i32 %4, 1
|
|
br label %voiderr
|
|
voiderr: ; preds = %after_check, %postfailed1
|
|
ret i32 1
|
|
} |