Incorrect codegen if a macro ends with unreachable and is assigned to something. #2210

This commit is contained in:
Christoffer Lerno
2025-06-15 22:35:44 +02:00
parent 07eee04e94
commit 3ce15bd7af
3 changed files with 41 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
// #target: windows-x64
module test;
macro int create_int2() {
$$unreachable();
}
fn void test()
{
int x = create_int2();
}
macro int? create_int()
{
$$unreachable();
}
fn int main()
{
int? x = create_int();
}
/* #expect: test.ll
define void @test.test() #0 {
entry:
%x = alloca i32, align 4
%blockret = alloca i32, align 4
unreachable
}
define i32 @main() #0 {
entry:
%x = alloca i32, align 4
%x.f = alloca i64, align 8
%blockret = alloca i32, align 4
unreachable
}