Fixed gencontext_begin_module using wrong reloc_model. (#1384)

Fixed gencontext_begin_module using wrong reloc_model.
This commit is contained in:
Itzerr
2024-08-25 18:08:33 +02:00
committed by GitHub
parent e1bbab3831
commit 734e0f350a
8 changed files with 572 additions and 551 deletions

View File

@@ -73,7 +73,7 @@ void gencontext_begin_module(GenContext *c)
static const char *pic_level = "PIC Level";
static const char *pie_level = "PIE Level";
switch (compiler.build.reloc_model)
switch (compiler.platform.reloc_model)
{
case RELOC_BIG_PIE:
llvm_set_module_flag(c, LLVMModuleFlagBehaviorOverride, pie_level, (unsigned)2 /* PIE */, type_uint);

View File

@@ -1640,18 +1640,20 @@ static RelocModel arch_os_reloc_default(ArchType arch, OsType os, EnvironmentTyp
case OS_UNSUPPORTED:
UNREACHABLE
case OS_TYPE_OPENBSD:
case OS_DARWIN_TYPES:
return RELOC_SMALL_PIC;
case OS_DARWIN_TYPES:
return RELOC_BIG_PIC;
case OS_TYPE_WIN32:
return ARCH_TYPE_X86_64 == arch ? RELOC_SMALL_PIC : RELOC_NONE;
if (arch == ARCH_TYPE_X86) return RELOC_NONE;
return RELOC_BIG_PIC;
case OS_TYPE_LINUX:
return RELOC_BIG_PIC;
case OS_TYPE_WASI:
return RELOC_NONE;
case OS_TYPE_LINUX:
return RELOC_SMALL_PIC;
case OS_TYPE_UNKNOWN:
case OS_TYPE_NONE:
case OS_TYPE_FREE_BSD:
case OS_TYPE_NETBSD:
case OS_TYPE_UNKNOWN:
case OS_TYPE_NONE:
switch (arch)
{
case ARCH_TYPE_MIPS64:
@@ -1667,14 +1669,26 @@ static RelocModel arch_os_reloc_default(ArchType arch, OsType os, EnvironmentTyp
{
case OS_TYPE_UNKNOWN:
case OS_TYPE_NONE:
return RELOC_NONE;
case OS_TYPE_OPENBSD:
case OS_TYPE_WIN32:
case OS_DARWIN_TYPES:
case OS_TYPE_WASI:
case OS_TYPE_FREE_BSD:
case OS_TYPE_NETBSD:
switch (arch)
{
case ARCH_TYPE_MIPS64:
case ARCH_TYPE_MIPS64EL:
return RELOC_SMALL_PIC;
default:
return RELOC_NONE;
}
case OS_DARWIN_TYPES:
return RELOC_BIG_PIC;
case OS_TYPE_WIN32:
if (arch == ARCH_TYPE_X86) return RELOC_NONE;
return RELOC_BIG_PIC;
case OS_TYPE_WASI:
return RELOC_NONE;
case OS_TYPE_LINUX:
return RELOC_BIG_PIE;
case OS_TYPE_OPENBSD:
return RELOC_SMALL_PIE;
case OS_UNSUPPORTED:
UNREACHABLE

View File

@@ -26,8 +26,7 @@ fn void main()
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@"$ct.int" = linkonce global %.introspect { i8 2, i64 0, ptr null, i64 4, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8
; Function Attrs:
define void @test.main() #0 !dbg !6 {
define void @test.main() #0 !dbg !7 {
entry:
%a = alloca i32, align 4
%x = alloca i32, align 4
@@ -40,111 +39,107 @@ entry:
%value6 = alloca i32, align 4
%varargslots = alloca [1 x %any], align 16
%retparam = alloca i64, align 8
!12
store i32 111, ptr %a, align 4, !dbg !13
!15
store i32 111, ptr %a, align 4, !dbg !14
store ptr %a, ptr %x1, align 8
%0 = load ptr, ptr %x1, align 8, !dbg !16
%1 = load atomic i32, ptr %0 seq_cst, align 4, !dbg !16
store i32 %1, ptr %x, align 4, !dbg !16
!21
%0 = load ptr, ptr %x1, align 8, !dbg !17
%1 = load atomic i32, ptr %0 seq_cst, align 4, !dbg !17
store i32 %1, ptr %x, align 4, !dbg !17
store ptr %a, ptr %x2, align 8
%2 = load ptr, ptr %x2, align 8, !dbg !22
%3 = load atomic volatile i32, ptr %2 monotonic, align 4, !dbg !22
store i32 %3, ptr %y, align 4, !dbg !22
%2 = load ptr, ptr %x2, align 8, !dbg !23
%3 = load atomic volatile i32, ptr %2 monotonic, align 4, !dbg !23
store i32 %3, ptr %y, align 4, !dbg !23
store ptr %a, ptr %x3, align 8
%4 = load i32, ptr %x, align 4, !dbg !25
%add = add i32 123, %4, !dbg !26
%4 = load i32, ptr %x, align 4, !dbg !26
%add = add i32 123, %4, !dbg !27
store i32 %add, ptr %value, align 4
%5 = load ptr, ptr %x3, align 8, !dbg !27
%6 = load i32, ptr %value, align 4, !dbg !27
store atomic i32 %6, ptr %5 seq_cst, align 4, !dbg !27
%5 = load ptr, ptr %x3, align 8, !dbg !28
%6 = load i32, ptr %value, align 4, !dbg !28
store atomic i32 %6, ptr %5 seq_cst, align 4, !dbg !28
store ptr %a, ptr %x4, align 8
%7 = load i32, ptr %y, align 4, !dbg !30
%add5 = add i32 33, %7, !dbg !31
%7 = load i32, ptr %y, align 4, !dbg !31
%add5 = add i32 33, %7, !dbg !32
store i32 %add5, ptr %value6, align 4
%8 = load ptr, ptr %x4, align 8, !dbg !32
%9 = load i32, ptr %value6, align 4, !dbg !32
store atomic volatile i32 %9, ptr %8 monotonic, align 4, !dbg !32
%10 = insertvalue %any undef, ptr %a, 0, !dbg !35
%11 = insertvalue %any %10, i64 ptrtoint (ptr @"$ct.int" to i64), 1, !dbg !35
store %any %11, ptr %varargslots, align 16, !dbg !35
%12 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1), !dbg !36
ret void, !dbg !36
%8 = load ptr, ptr %x4, align 8, !dbg !33
%9 = load i32, ptr %value6, align 4, !dbg !33
store atomic volatile i32 %9, ptr %8 monotonic, align 4, !dbg !33
%10 = insertvalue %any undef, ptr %a, 0, !dbg !36
%11 = insertvalue %any %10, i64 ptrtoint (ptr @"$ct.int" to i64), 1, !dbg !36
store %any %11, ptr %varargslots, align 16, !dbg !36
%12 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1), !dbg !37
ret void, !dbg !37
}
; Function Attrs: nounwind uwtable
define i32 @main(i32 %0, ptr %1) #0 !dbg !37 {
define i32 @main(i32 %0, ptr %1) #0 !dbg !38 {
entry:
%.anon = alloca i32, align 4
%.anon1 = alloca ptr, align 8
%.anon2 = alloca i32, align 4
%.anon3 = alloca ptr, align 8
store i32 %0, ptr %.anon, align 4
!44
store ptr %1, ptr %.anon1, align 8
!44
%2 = load i32, ptr %.anon, align 4
store i32 %2, ptr %.anon2, align 4
%3 = load ptr, ptr %.anon1, align 8
store ptr %3, ptr %.anon3, align 8
call void @test.main(), !dbg !46
ret i32 0, !dbg !49
call void @test.main(), !dbg !47
ret i32 0, !dbg !50
}
e
declare i64 @std.io.printfn(ptr, ptr, i64, ptr, i64) #0
declare i1 @llvm.expect.i1(i1, i1)
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.dbg.cu = !{!4}
!llvm.module.flags = !{!0, !1, !2, !3, !4}
!llvm.dbg.cu = !{!5}
!0 = !{i32 2, !"Dwarf Version", i32 4}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = !{i32 2, !"frame-pointer", i32 2}
!3 = !{i32 1, !"uwtable", i32 2}
!4 = distinct !DICompileUnit(language: DW_LANG_C11, file: !5, producer: "c3c", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false)
!5 = !DIFile(filename: "atomic_load_store_debug.c3"
!6 = distinct !DISubprogram(name: "main", linkageName: "test.main", scope: !5, file: !5, line: 10, type: !7, scopeLine: 10, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !4, retainedNodes: !9)
!7 = !DISubroutineType(types: !8)
!8 = !{null}
!9 = !{}
!10 = !DILocalVariable(name: "a", scope: !6, file: !5, line: 12, type: !11, align: 4)
!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!12 = !DILocation(line: 12, column: 6, scope: !6)
!13 = !DILocation(line: 12, column: 10, scope: !6)
!14 = !DILocalVariable(name: "x", scope: !6, file: !5, line: 13, type: !11, align: 4)
!15 = !DILocation(line: 13, column: 6, scope: !6)
!16 = !DILocation(line:
!17 = distinct !DISubprogram(name: "@atomic_load",
!18 = !DIFile(filename: "mem.c3",
!19 = !DILocation(line: 13, column: 10, scope: !6)
!20 = !DILocalVariable(name: "y", scope: !6, file: !5, line: 14, type: !11, align: 4)
!21 = !DILocation(line: 14, column: 6, scope: !6)
!22 = !DILocation(line:
!23 = distinct !DISubprogram(name: "@atomic_load", linkageName: "@atomic_load", scope: !18
!24 = !DILocation(line: 14, column: 10, scope: !6)
!25 = !DILocation(line: 15, column: 25, scope: !6)
!26 = !DILocation(line: 15, column: 19, scope: !6)
!27 = !DILocation(
!28 = distinct !DISubprogram(name: "@atomic_store", linkageName: "@atomic_store", scope: !18
!29 = !DILocation(line: 15, column: 2, scope: !6)
!30 = !DILocation(line: 16, column: 24, scope: !6)
!31 = !DILocation(line: 16, column: 19, scope: !6)
!32 = !DILocation(
!33 = distinct !DISubprogram(name: "@atomic_store", linkageName: "@atomic_store", scope: !18
!34 = !DILocation(line: 16, column: 2, scope: !6)
!35 = !DILocation(line: 17, column: 20, scope: !6)
!36 = !DILocation(line: 17, column: 6, scope: !6)
!37 = distinct !DISubprogram(name: "_$main", linkageName: "main", scope: !5, file: !5, line: 10, type: !38, scopeLine: 10, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !4, retainedNodes: !9)
!38 = !DISubroutineType(types: !39)
!39 = !{!11, !11, !40}
!40 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char**", baseType: !41, size: 64, align: 64, dwarfAddressSpace: 0)
!41 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char*", baseType: !42, size: 64, align: 64, dwarfAddressSpace: 0)
!42 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char)
!43 = !DILocalVariable(name: ".anon", arg: 1, scope: !37, file: !5, line: 10, type: !11)
!44 = !DILocation(line: 10, column: 9, scope: !37)
!45 = !DILocalVariable(name: ".anon", arg: 2, scope: !37, file: !5, line: 10, type: !40)
!46 = !DILocation(line: 18, column: 2, scope: !47, inlinedAt: !44)
!47 = distinct !DISubprogram(name: "@main_to_void_main", linkageName: "@main_to_void_main", scope: !48, file: !48, line: 16, scopeLine: 16, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
!48 = !DIFile(filename: "main_stub.c3", directory:
!49 = !DILocation(line: 19, column: 9, scope: !47, inlinedAt: !44)
!0 = !{i32 4, !"PIC Level", i32 2}
!1 = !{i32 2, !"Dwarf Version", i32 4}
!2 = !{i32 2, !"Debug Info Version", i32 3}
!3 = !{i32 2, !"frame-pointer", i32 2}
!4 = !{i32 1, !"uwtable", i32 2}
!5 = distinct !DICompileUnit(language: DW_LANG_C11, file: !6, producer: "c3c", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false)
!6 = !DIFile(filename: "atomic_load_store_debug.c3"
!7 = distinct !DISubprogram(name: "main", linkageName: "test.main", scope: !6, file: !6, line: 10, type: !8, scopeLine: 10, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !10)
!8 = !DISubroutineType(types: !9)
!9 = !{null}
!10 = !{}
!11 = !DILocalVariable(name: "a", scope: !7, file: !6, line: 12, type: !12, align: 4)
!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!13 = !DILocation(line: 12, column: 6, scope: !7)
!14 = !DILocation(line: 12, column: 10, scope: !7)
!15 = !DILocalVariable(name: "x", scope: !7, file: !6, line: 13, type: !12, align: 4)
!16 = !DILocation(line: 13, column: 6, scope: !7)
!17 = !DILocation(
!18 = distinct !DISubprogram(name: "@atomic_load",
!19 = !DIFile(filename: "mem.c3",
!20 = !DILocation(line: 13, column: 10, scope: !7)
!21 = !DILocalVariable(name: "y", scope: !7, file: !6, line: 14, type: !12, align: 4)
!22 = !DILocation(line: 14, column: 6, scope: !7)
!23 = !DILocation(
!24 = distinct !DISubprogram(name: "@atomic_load", linkageName: "@atomic_load", scope: !19, file: !19, line: 225, scopeLine: 225, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5)
!25 = !DILocation(line: 14, column: 10, scope: !7)
!26 = !DILocation(line: 15, column: 25, scope: !7)
!27 = !DILocation(line: 15, column: 19, scope: !7)
!28 = !DILocation(
!29 = distinct !DISubprogram(name: "@atomic_store", linkageName: "@atomic_store", scope: !19, file: !19, line: 240, scopeLine: 240, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5)
!30 = !DILocation(line: 15, column: 2, scope: !7)
!31 = !DILocation(line: 16, column: 24, scope: !7)
!32 = !DILocation(line: 16, column: 19, scope: !7)
!33 = !DILocation(
!34 = distinct !DISubprogram(name: "@atomic_store", linkageName: "@atomic_store", scope: !19, file: !19, line: 240, scopeLine: 240, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5)
!35 = !DILocation(line: 16, column: 2, scope: !7)
!36 = !DILocation(line: 17, column: 20, scope: !7)
!37 = !DILocation(line: 17, column: 6, scope: !7)
!38 = distinct !DISubprogram(name: "_$main", linkageName: "main", scope: !6, file: !6, line: 10, type: !39, scopeLine: 10, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !10)
!39 = !DISubroutineType(types: !40)
!40 = !{!12, !12, !41}
!41 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char**", baseType: !42, size: 64, align: 64, dwarfAddressSpace: 0)
!42 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char*", baseType: !43, size: 64, align: 64, dwarfAddressSpace: 0)
!43 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char)
!44 = !DILocalVariable(name: ".anon", arg: 1, scope: !38, file: !6, line: 10, type: !12)
!45 = !DILocation(line: 10, column: 9, scope: !38)
!46 = !DILocalVariable(name: ".anon", arg: 2, scope: !38, file: !6, line: 10, type: !41)
!47 = !DILocation(
!48 = distinct !DISubprogram(name: "@main_to_void_main", linkageName: "@main_to_void_main", scope: !49, file: !49, line: 16, scopeLine: 16, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5)
!49 = !DIFile(filename: "main_stub.c3", directory:
!50 = !DILocation(

View File

@@ -12,8 +12,8 @@ const FOO @private = ~(uint)(0);
@constants.CC = internal unnamed_addr constant i32 -1, align 4, !dbg !6
@constants.FOO = internal unnamed_addr constant i32 -1, align 4, !dbg !9
!llvm.module.flags = !{!11, !12, !13, !14}
!llvm.dbg.cu = !{!15}
!llvm.module.flags = !{!11, !12, !13, !14, !15}
!llvm.dbg.cu = !{!16}
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = distinct !DIGlobalVariable(name: "AA", linkageName: "constants.AA", scope: !2
@@ -26,9 +26,10 @@ const FOO @private = ~(uint)(0);
!8 = !DIBasicType(name: "uint", size: 32, encoding: DW_ATE_unsigned)
!9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression())
!10 = distinct !DIGlobalVariable(name: "FOO", linkageName: "constants.FOO", scope: !2, file: !2, line: 4, type: !8, isLocal: true, isDefinition: true, align: 4)
!11 = !{i32 2, !"Dwarf Version", i32 4}
!12 = !{i32 2, !"Debug Info Version", i32 3}
!13 = !{i32 2, !"frame-pointer", i32 2}
!14 = !{i32 1, !"uwtable", i32 2}
!15 = distinct !DICompileUnit(language: DW_LANG_C11, file: !2, producer: "c3c", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !16, splitDebugInlining: false)
!16 = !{!0, !4, !6, !9}
!11 = !{i32 4, !"PIC Level", i32 2}
!12 = !{i32 2, !"Dwarf Version", i32 4}
!13 = !{i32 2, !"Debug Info Version", i32 3}
!14 = !{i32 2, !"frame-pointer", i32 2}
!15 = !{i32 1, !"uwtable", i32 2}
!16 = distinct !DICompileUnit(language: DW_LANG_C11, file: !2, producer: "c3c", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !17, splitDebugInlining: false)
!17 = !{!0, !4, !6, !9}

View File

@@ -14,8 +14,8 @@ const FOO @private = ~(uint)(0);
@constants_mingw.CC = internal unnamed_addr constant i32 -1, align 4, !dbg !6
@constants_mingw.FOO = internal unnamed_addr constant i32 -1, align 4, !dbg !9
!llvm.module.flags = !{!11, !12, !13, !14}
!llvm.dbg.cu = !{!15}
!llvm.module.flags = !{!11, !12, !13, !14, !15}
!llvm.dbg.cu = !{!16}
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = distinct !DIGlobalVariable(name: "AA", linkageName: "constants_mingw.AA", scope: !2, file: !2, line: 1, type: !3, isLocal: true, isDefinition: true, align: 1)
@@ -28,9 +28,10 @@ const FOO @private = ~(uint)(0);
!8 = !DIBasicType(name: "uint", size: 32, encoding: DW_ATE_unsigned)
!9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression())
!10 = distinct !DIGlobalVariable(name: "FOO", linkageName: "constants_mingw.FOO", scope: !2, file: !2, line: 4, type: !8, isLocal: true, isDefinition: true, align: 4)
!11 = !{i32 2, !"Dwarf Version", i32 4}
!12 = !{i32 2, !"Debug Info Version", i32 3}
!13 = !{i32 2, !"frame-pointer", i32 2}
!14 = !{i32 1, !"uwtable", i32 2}
!15 = distinct !DICompileUnit(language: DW_LANG_C11, file: !2, producer: "c3c", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !16, splitDebugInlining: false)
!16 = !{!0, !4, !6, !9}
!11 = !{i32 4, !"PIC Level", i32 2}
!12 = !{i32 2, !"Dwarf Version", i32 4}
!13 = !{i32 2, !"Debug Info Version", i32 3}
!14 = !{i32 2, !"frame-pointer", i32 2}
!15 = !{i32 1, !"uwtable", i32 2}
!16 = distinct !DICompileUnit(language: DW_LANG_C11, file: !2, producer: "c3c", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !17, splitDebugInlining: false)
!17 = !{!0, !4, !6, !9}

View File

@@ -16,42 +16,46 @@ fn void main() {
/* #expect: test.ll
define void @test.foo() #0 !dbg !6 {
define void @test.foo() #0 !dbg !7 {
entry:
%values = alloca [1 x i32], align 4
!15
store i32 0, ptr %values, align 4, !dbg !15
store i32 0, ptr %values, align 4, !dbg !16
ret void, !dbg !16
store i32 0, ptr %values, align 4, !dbg !17
ret void, !dbg !17
}
!0 = !{i32 2, !"Dwarf Version", i32 4}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = !{i32 2, !"frame-pointer", i32 2}
!3 = !{i32 1, !"uwtable", i32 2}
!7 = !DISubroutineType(types: !8)
!8 = !{null}
!9 = !{}
!10 = !DILocalVariable(name: "values", scope: !6, file: !5, line: 5, type: !11, align: 4)
!11 = !DICompositeType(tag: DW_TAG_array_type, baseType: !12, size: 32, align: 32, elements: !13)
!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!13 = !{!14}
!14 = !DISubrange(count: 1, lowerBound: 0)
!15 = !DILocation(line: 5, column: 10, scope: !6)
!16 = !DILocation(line: 7, column: 18, scope: !17)
!17 = distinct !DILexicalBlock(scope: !18, file: !5, line: 6, column: 3)
!18 = distinct !DILexicalBlock(scope: !6, file: !5, line: 6, column: 3)
!19 = distinct !DISubprogram(name: "main", linkageName: "test.main", scope: !5, file: !5, line: 11, type: !7, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition
!20 = !DILocation(line: 12, column: 3, scope: !19)
!21 = distinct !DISubprogram(name: "_$main", linkageName: "main", scope: !5, file: !5, line: 11, type: !22, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition
!22 = !DISubroutineType(types: !23)
!23 = !{!12, !12, !24}
!24 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char**", baseType: !25, size: 64, align: 64
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char*", baseType: !26, size: 64, align: 64
!26 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char)
!27 = !DILocalVariable(name: ".anon", arg: 1, scope: !21, file: !5, line: 11, type: !12)
!28 = !DILocation(line: 11, column: 9, scope: !21)
!29 = !DILocalVariable(name: ".anon", arg: 2, scope: !21, file: !5, line: 11, type: !24)
!30 = !DILocation(line: 18, column: 2, scope: !31, inlinedAt: !28)
!31 = distinct !DISubprogram(name: "@main_to_void_main", linkageName: "@main_to_void_main", scope: !32, file: !32, line: 16, scopeLine: 16, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
!32 = !DIFile(filename: "main_stub.c3"
!33 = !DILocation(line: 19, column: 9, scope: !31, inlinedAt: !28)
!0 = !{i32 4, !"PIC Level", i32 2}
!1 = !{i32 2, !"Dwarf Version", i32 4}
!2 = !{i32 2, !"Debug Info Version", i32 3}
!3 = !{i32 2, !"frame-pointer", i32 2}
!4 = !{i32 1, !"uwtable", i32 2}
!5 = distinct !DICompileUnit
!6 = !DIFile(filename:
!7 = distinct !DISubprogram(name: "foo", linkageName: "test.foo", scope: !6, file: !6, line: 4, type: !8, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !10)
!8 = !DISubroutineType(types: !9)
!9 = !{null}
!10 = !{}
!11 = !DILocalVariable(name: "values", scope: !7, file: !6, line: 5, type: !12, align: 4)
!12 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 32, align: 32, elements: !14)
!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!14 = !{!15}
!15 = !DISubrange(count: 1, lowerBound: 0)
!16 = !DILocation(line: 5, column: 10, scope: !7)
!17 = !DILocation(line: 7, column: 18, scope: !18)
!18 = distinct !DILexicalBlock(scope: !19, file: !6, line: 6, column: 3)
!19 = distinct !DILexicalBlock(scope: !7, file: !6, line: 6, column: 3)
!20 = distinct !DISubprogram(name: "main", linkageName: "test.main", scope: !6, file: !6, line: 11, type: !8, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !5)
!21 = !DILocation(line: 12, column: 3, scope: !20)
!22 = distinct !DISubprogram(name: "_$main", linkageName: "main", scope: !6, file: !6, line: 11, type: !23, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !10)
!23 = !DISubroutineType(types: !24)
!24 = !{!13, !13, !25}
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char**", baseType: !26, size: 64, align: 64, dwarfAddressSpace: 0)
!26 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char*", baseType: !27, size: 64, align: 64, dwarfAddressSpace: 0)
!27 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char)
!28 = !DILocalVariable(name: ".anon", arg: 1, scope: !22, file: !6, line: 11, type: !13)
!29 = !DILocation(line: 11, column: 9, scope: !22)
!30 = !DILocalVariable(name: ".anon", arg: 2, scope: !22, file: !6, line: 11, type: !25)
!31 = !DILocation(line: 18, column: 2, scope: !32, inlinedAt: !29)
!32 = distinct !DISubprogram(name: "@main_to_void_main", linkageName: "@main_to_void_main", scope: !33, file: !33, line: 16, scopeLine: 16, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5)
!33 = !DIFile(filename: "main_stub.c3"
!34 = !DILocation(line: 19, column: 9, scope: !32, inlinedAt: !29)

View File

@@ -133,31 +133,35 @@ fn Attach_Arg to_scope() @inline {
/* #expect: test.ll
define void @test.foo(i32 %0) #0 !dbg !16 {
define void @test.foo(i32 %0) #0 !dbg !17 {
entry:
%x = alloca i32, align 4
%a = alloca i32, align 4
%a.f = alloca i64, align 8
store i32 %0, ptr %x, align 4
!20
!22
%1 = load i32, ptr %x, align 4, !dbg !24
store i32 %1, ptr %a, align 4, !dbg !24
store i64 0, ptr %a.f, align 8, !dbg !24
br label %loop.cond, !dbg !25
!21
!23
%1 = load i32, ptr %x, align 4, !dbg !25
store i32 %1, ptr %a, align 4, !dbg !25
store i64 0, ptr %a.f, align 8, !dbg !25
br label %loop.cond, !dbg !26
loop.cond: ; preds = %loop.body, %entry
%load.err = load i64, ptr %a.f, align 8, !dbg !26
%result = icmp eq i64 %load.err, 0, !dbg !26
br i1 %result, label %loop.body, label %loop.exit, !dbg !26
%load.err = load i64, ptr %a.f, align 8, !dbg !27
%result = icmp eq i64 %load.err, 0, !dbg !27
br i1 %result, label %loop.body, label %loop.exit, !dbg !27
loop.body: ; preds = %loop.cond
store i32 2, ptr %a, align 4, !dbg !28
store i64 0, ptr %a.f, align 8, !dbg !28
br label %loop.cond, !dbg !28
store i32 2, ptr %a, align 4, !dbg !29
store i64 0, ptr %a.f, align 8, !dbg !29
br label %loop.cond, !dbg !29
loop.exit: ; preds = %loop.cond
ret void, !dbg !28
ret void, !dbg !29
}
; Function Attrs: nounwind uwtable
define i32 @test.main(ptr %0, i64 %1) #0 !dbg !30 {
define i32 @test.main(ptr %0, i64 %1) #0 !dbg !31 {
entry:
%args = alloca %"char[][]", align 8
%asdf = alloca ptr, align 8
@@ -165,25 +169,25 @@ entry:
store ptr %0, ptr %args, align 8
%ptradd = getelementptr inbounds i8, ptr %args, i64 8
store i64 %1, ptr %ptradd, align 8
!47
!49
!48
!50
%2 = call { i32, ptr } @attach.to_scope()
store { i32, ptr } %2, ptr %result, align 8
%lo = load i32, ptr %result, align 8, !dbg !56
%ptradd1 = getelementptr inbounds i8, ptr %result, i64 8, !dbg !56
%hi = load ptr, ptr %ptradd1, align 8, !dbg !56
%3 = call ptr @test.create_foo(i32 %lo, ptr %hi, i64 1, ptr null, i64 0), !dbg !58
store ptr %3, ptr %asdf, align 8, !dbg !58
%ptradd2 = getelementptr inbounds i8, ptr %args, i64 8, !dbg !59
%4 = load i64, ptr %ptradd2, align 8, !dbg !59
%neq = icmp ne i64 0, %4, !dbg !59
%ternary = select i1 %neq, <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00>, <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, !dbg !60
%5 = call ptr @test.test(<4 x float> %ternary), !dbg !61
%6 = call ptr @test.test2(), !dbg !62
ret i32 0, !dbg !63
%lo = load i32, ptr %result, align 8, !dbg !57
%ptradd1 = getelementptr inbounds i8, ptr %result, i64 8, !dbg !57
%hi = load ptr, ptr %ptradd1, align 8, !dbg !57
%3 = call ptr @test.create_foo(i32 %lo, ptr %hi, i64 1, ptr null, i64 0), !dbg !59
store ptr %3, ptr %asdf, align 8, !dbg !59
%ptradd2 = getelementptr inbounds i8, ptr %args, i64 8, !dbg !60
%4 = load i64, ptr %ptradd2, align 8, !dbg !60
%neq = icmp ne i64 0, %4, !dbg !60
%ternary = select i1 %neq, <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00>, <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, !dbg !61
%5 = call ptr @test.test(<4 x float> %ternary), !dbg !62
%6 = call ptr @test.test2(), !dbg !63
ret i32 0, !dbg !64
}
define ptr @test.create_foo(i32 %0, ptr %1, i64 %2, ptr %3, i64 %4) #0 !dbg !64 {
define ptr @test.create_foo(i32 %0, ptr %1, i64 %2, ptr %3, i64 %4) #0 !dbg !65 {
entry:
%attach = alloca %Attach_Arg, align 8
%flags = alloca i64, align 8
@@ -191,18 +195,18 @@ entry:
store i32 %0, ptr %attach, align 8
%ptradd = getelementptr inbounds i8, ptr %attach, i64 8
store ptr %1, ptr %ptradd, align 8
!67
!68
store i64 %2, ptr %flags, align 8
!69
!70
store ptr %3, ptr %name, align 8
%ptradd1 = getelementptr inbounds i8, ptr %name, i64 8
store i64 %4, ptr %ptradd1, align 8
!71
%5 = call ptr @std.core.mem.calloc(i64 8)
ret ptr %5, !dbg !73
ret ptr %5, !dbg !74
}
define ptr @test.test(<4 x float> %0) #0 !dbg !77
define ptr @test.test(<4 x float> %0) #0 !dbg !78 {
entry:
%color = alloca <4 x float>, align 16
%x = alloca <4 x float>, align 16
@@ -219,92 +223,92 @@ entry:
%error_var5 = alloca i64, align 8
%error_var11 = alloca i64, align 8
store <4 x float> %0, ptr %color, align 16
!85
!86
%1 = load <4 x float>, ptr %color, align 16
store <4 x float> %1, ptr %x, align 16
%2 = call ptr @std.io.stdout(), !dbg !87
%2 = call ptr @std.io.stdout(), !dbg !88
store ptr %2, ptr %out, align 8
%3 = load <4 x float>, ptr %x, align 16
store <4 x float> %3, ptr %x1, align 16
!91
!92
%4 = load ptr, ptr %out, align 8
store ptr %4, ptr %out2, align 8
%5 = load <4 x float>, ptr %x1, align 16
store <4 x float> %5, ptr %x3, align 16
%6 = load ptr, ptr %out2, align 8, !dbg !95
%7 = insertvalue %any undef, ptr %6, 0, !dbg !95
%8 = insertvalue %any %7, i64 ptrtoint (ptr @"$ct.std.io.File" to i64), 1, !dbg !95
%9 = insertvalue %any undef, ptr %x3, 0, !dbg !98
%10 = insertvalue %any %9, i64 ptrtoint (ptr @"$ct.foo.Color" to i64), 1, !dbg !98
store %any %10, ptr %varargslots, align 16, !dbg !98
%11 = insertvalue %"any[]" undef, ptr %varargslots, 0, !dbg !98
%"$$temp" = insertvalue %"any[]" %11, i64 1, 1, !dbg !98
%6 = load ptr, ptr %out2, align 8, !dbg !96
%7 = insertvalue %any undef, ptr %6, 0, !dbg !96
%8 = insertvalue %any %7, i64 ptrtoint (ptr @"$ct.std.io.File" to i64), 1, !dbg !96
%9 = insertvalue %any undef, ptr %x3, 0, !dbg !99
%10 = insertvalue %any %9, i64 ptrtoint (ptr @"$ct.foo.Color" to i64), 1, !dbg !99
store %any %10, ptr %varargslots, align 16, !dbg !99
%11 = insertvalue %"any[]" undef, ptr %varargslots, 0, !dbg !99
%"$$temp" = insertvalue %"any[]" %11, i64 1, 1, !dbg !99
store %any %8, ptr %taddr, align 8
%lo = load i64, ptr %taddr, align 8
%ptradd = getelementptr inbounds i8, ptr %taddr, i64 8
%hi = load ptr, ptr %ptradd, align 8
store %"any[]" %"$$temp", ptr %indirectarg, align 8
%12 = call i64 @std.io.fprintf(ptr %retparam, i64 %lo, ptr %hi, ptr @.str, i64 2, ptr byval(%"any[]") align 8 %indirectarg), !dbg !99
%not_err = icmp eq i64 %12, 0, !dbg !99
%13 = call i1 @llvm.expect.i1(i1 %not_err, i1 true), !dbg !99
br i1 %13, label %after_check, label %assign_optional, !dbg !99
%12 = call i64 @std.io.fprintf(ptr %retparam, i64 %lo, ptr %hi, ptr @.str, i64 2, ptr byval(%"any[]") align 8 %indirectarg), !dbg !100
%not_err = icmp eq i64 %12, 0, !dbg !100
%13 = call i1 @llvm.expect.i1(i1 %not_err, i1 true), !dbg !100
br i1 %13, label %after_check, label %assign_optional, !dbg !100
assign_optional: ; preds = %entry
store i64 %12, ptr %error_var, align 8, !dbg !99
br label %guard_block, !dbg !99
store i64 %12, ptr %error_var, align 8, !dbg !100
br label %guard_block, !dbg !100
after_check: ; preds = %entry
br label %noerr_block, !dbg !99
br label %noerr_block, !dbg !100
guard_block: ; preds = %assign_optional
br label %voiderr, !dbg !99
br label %voiderr, !dbg !100
noerr_block: ; preds = %after_check
%14 = load i64, ptr %retparam, align 8, !dbg !99
store i64 %14, ptr %len, align 8, !dbg !99
%15 = load ptr, ptr %out, align 8, !dbg !100
%16 = call i64 @std.io.File.write_byte(ptr %15, i8 zeroext 10), !dbg !101
%not_err6 = icmp eq i64 %16, 0, !dbg !101
%17 = call i1 @llvm.expect.i1(i1 %not_err6, i1 true), !dbg !101
br i1 %17, label %after_check8, label %assign_optional7, !dbg !101
%14 = load i64, ptr %retparam, align 8, !dbg !100
store i64 %14, ptr %len, align 8, !dbg !100
%15 = load ptr, ptr %out, align 8, !dbg !101
%16 = call i64 @std.io.File.write_byte(ptr %15, i8 zeroext 10), !dbg !102
%not_err6 = icmp eq i64 %16, 0, !dbg !102
%17 = call i1 @llvm.expect.i1(i1 %not_err6, i1 true), !dbg !102
br i1 %17, label %after_check8, label %assign_optional7, !dbg !102
assign_optional7: ; preds = %noerr_block
store i64 %16, ptr %error_var5, align 8, !dbg !101
br label %guard_block9, !dbg !101
store i64 %16, ptr %error_var5, align 8, !dbg !102
br label %guard_block9, !dbg !102
after_check8: ; preds = %noerr_block
br label %noerr_block10, !dbg !101
br label %noerr_block10, !dbg !102
guard_block9: ; preds = %assign_optional7
br label %voiderr, !dbg !101
noerr_block10: ; preds = %after_check8
%18 = load ptr, ptr %out, align 8, !dbg !102
%19 = call i64 @std.io.File.flush(ptr %18), !dbg !102
%not_err12 = icmp eq i64 %19, 0, !dbg !102
%20 = call i1 @llvm.expect.i1(i1 %not_err12, i1 true), !dbg !102
br i1 %20, label %after_check14, label %assign_optional13, !dbg !102
assign_optional13: ; preds = %noerr_block10
store i64 %19, ptr %error_var11, align 8, !dbg !102
br label %guard_block15, !dbg !102
after_check14: ; preds = %noerr_block10
br label %noerr_block16, !dbg !102
guard_block15: ; preds = %assign_optional13
br label %voiderr, !dbg !102
noerr_block10: ; preds = %after_check8
%18 = load ptr, ptr %out, align 8, !dbg !103
%19 = call i64 @std.io.File.flush(ptr %18), !dbg !103
%not_err12 = icmp eq i64 %19, 0, !dbg !103
%20 = call i1 @llvm.expect.i1(i1 %not_err12, i1 true), !dbg !103
br i1 %20, label %after_check14, label %assign_optional13, !dbg !103
assign_optional13: ; preds = %noerr_block10
store i64 %19, ptr %error_var11, align 8, !dbg !103
br label %guard_block15, !dbg !103
after_check14: ; preds = %noerr_block10
br label %noerr_block16, !dbg !103
guard_block15: ; preds = %assign_optional13
br label %voiderr, !dbg !103
noerr_block16: ; preds = %after_check14
%21 = load i64, ptr %len, align 8, !dbg !103
%add = add i64 %21, 1, !dbg !103
br label %voiderr, !dbg !94
%21 = load i64, ptr %len, align 8, !dbg !104
%add = add i64 %21, 1, !dbg !104
br label %voiderr, !dbg !95
voiderr: ; preds = %noerr_block16, %guard_block15, %guard_block9, %guard_block
ret ptr null, !dbg !104
ret ptr null, !dbg !105
}
define ptr @test.test2() #0 !dbg !105 {
define ptr @test.test2() #0 !dbg !106 {
entry:
%conflicts = alloca %"Arena*[]", align 8
%scratch = alloca %Arena_Cursor, align 8
@@ -312,27 +316,27 @@ entry:
%scratch1 = alloca ptr, align 8
%asdf = alloca ptr, align 8
store %"Arena*[]" zeroinitializer, ptr %conflicts, align 8
!108
%lo = load ptr, ptr %conflicts, align 8, !dbg !120
%ptradd = getelementptr inbounds i8, ptr %conflicts, i64 8, !dbg !120
%hi = load i64, ptr %ptradd, align 8, !dbg !120
%0 = call { ptr, i64 } @arena_scratch_begin(ptr %lo, i64 %hi), !dbg !121
!109
%lo = load ptr, ptr %conflicts, align 8, !dbg !121
%ptradd = getelementptr inbounds i8, ptr %conflicts, i64 8, !dbg !121
%hi = load i64, ptr %ptradd, align 8, !dbg !121
%0 = call { ptr, i64 } @arena_scratch_begin(ptr %lo, i64 %hi), !dbg !122
store { ptr, i64 } %0, ptr %result, align 8
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %scratch, ptr align 8 %result, i32 16, i1 false)
!122
%1 = load ptr, ptr %scratch, align 8, !dbg !124
store ptr %1, ptr %scratch1, align 8, !dbg !124
!126
store ptr null, ptr %asdf, align 8, !dbg !128
%2 = load ptr, ptr %asdf, align 8, !dbg !129
%lo2 = load ptr, ptr %scratch, align 8, !dbg !130
%ptradd3 = getelementptr inbounds i8, ptr %scratch, i64 8, !dbg !130
%hi4 = load i64, ptr %ptradd3, align 8, !dbg !130
!123
%1 = load ptr, ptr %scratch, align 8, !dbg !125
store ptr %1, ptr %scratch1, align 8, !dbg !125
!127
store ptr null, ptr %asdf, align 8, !dbg !129
%2 = load ptr, ptr %asdf, align 8, !dbg !130
%lo2 = load ptr, ptr %scratch, align 8, !dbg !131
%ptradd3 = getelementptr inbounds i8, ptr %scratch, i64 8, !dbg !131
%hi4 = load i64, ptr %ptradd3, align 8, !dbg !131
call void @arena_scratch_end(ptr %lo2, i64 %hi4)
ret ptr %2, !dbg !132
ret ptr %2, !dbg !133
}
define i32 @main(i32 %0, ptr %1) #0 !dbg !133 {
define i32 @main(i32 %0, ptr %1) #0 !dbg !134 {
entry:
%.anon = alloca i32, align 4
%.anon1 = alloca ptr, align 8
@@ -365,21 +369,21 @@ entry:
%len18 = alloca i64, align 8
store ptr null, ptr %.cachedtype, align 8
store i32 %0, ptr %.anon, align 4
!137
!138
store ptr %1, ptr %.anon1, align 8
!139
!140
%2 = load i32, ptr %.anon, align 4
store i32 %2, ptr %argc, align 4
%3 = load ptr, ptr %.anon1, align 8
store ptr %3, ptr %argv, align 8
!140
!141
%4 = load i32, ptr %argc, align 4
store i32 %4, ptr %argc2, align 4
%5 = load ptr, ptr %argv, align 8
store ptr %5, ptr %argv3, align 8
!144
%6 = load i32, ptr %argc2, align 4, !dbg !148
%sext = sext i32 %6 to i64, !dbg !148
!145
%6 = load i32, ptr %argc2, align 4, !dbg !149
%sext = sext i32 %6 to i64, !dbg !149
store i64 %sext, ptr %elements, align 8
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %allocator, ptr align 8 @std.core.mem.allocator.thread_allocator, i32 16, i1 false)
%7 = load i64, ptr %elements, align 8
@@ -388,24 +392,25 @@ entry:
%8 = load i64, ptr %elements6, align 8
store i64 %8, ptr %elements8, align 8
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %allocator10, ptr align 8 %allocator7, i32 16, i1 false)
%9 = load i64, ptr %elements8, align 8, !dbg !149
%mul = mul i64 16, %9, !dbg !157
%9 = load i64, ptr %elements8, align 8, !dbg !150
%mul = mul i64 16, %9, !dbg !158
store i64 %mul, ptr %size, align 8
%10 = load i64, ptr %size, align 8, !dbg !158
%not = icmp eq i64 %10, 0, !dbg !158
br i1 %not, label %if.then, label %if.exit, !dbg !158
%10 = load i64, ptr %size, align 8, !dbg !159
%not = icmp eq i64 %10, 0, !dbg !159
br i1 %not, label %if.then, label %if.exit, !dbg !159
if.then: ; preds = %entry
store ptr null, ptr %blockret11, align 8, !dbg !161
br label %expr_block.exit, !dbg !161
store ptr null, ptr %blockret11, align 8, !dbg !162
br label %expr_block.exit, !dbg !162
if.exit: ; preds = %entry
%ptradd = getelementptr inbounds i8, ptr %allocator10, i64 8, !dbg !162
%11 = load i64, ptr %ptradd, align 8, !dbg !162
%12 = inttoptr i64 %11 to ptr, !dbg !162
%ptradd = getelementptr inbounds i8, ptr %allocator10, i64 8, !dbg !163
%11 = load i64, ptr %ptradd, align 8, !dbg !163
%12 = inttoptr i64 %11 to ptr, !dbg !163
%type = load ptr, ptr %.cachedtype, align 8
%13 = icmp eq ptr %12, %type
br i1 %13, label %cache_hit, label %cache_miss
cache_miss: ; preds = %if.exit
%ptradd12 = getelementptr inbounds i8, ptr %12, i64 16
%14 = load ptr, ptr %ptradd12, align 8
@@ -413,129 +418,132 @@ cache_miss: ; preds = %if.exit
store ptr %15, ptr %.inlinecache, align 8
store ptr %12, ptr %.cachedtype, align 8
br label %16
cache_hit: ; preds = %if.exit
%cache_hit_fn = load ptr, ptr %.inlinecache, align 8
br label %16
16: ; preds = %cache_hit, %cache_miss
%fn_phi = phi ptr [ %cache_hit_fn, %cache_hit ], [ %15, %cache_miss ]
%17 = icmp eq ptr %fn_phi, null
br i1 %17, label %missing_function, label %match
missing_function: ; preds = %16
%18 = load ptr, ptr @std.core.builtin.panic, align 8, !dbg !164
call void %18(ptr @.panic_msg, i64 44, ptr @.file, i64 16, ptr @.func, i64 6, i32 68), !dbg !164
unreachable, !dbg !164
%18 = load ptr, ptr @std.core.builtin.panic, align 8, !dbg !165
call void %18(ptr @.panic_msg, i64 44, ptr @.file, i64 16, ptr @.func, i64 6, i32 68), !dbg !165
unreachable, !dbg !165
match: ; preds = %16
%19 = load ptr, ptr %allocator10, align 8
%20 = load i64, ptr %size, align 8
%21 = call i64 %fn_phi(ptr %retparam, ptr %19, i64 %20, i32 0, i64 0), !dbg !164
%not_err = icmp eq i64 %21, 0, !dbg !164
%22 = call i1 @llvm.expect.i1(i1 %not_err, i1 true), !dbg !164
br i1 %22, label %after_check, label %assign_optional, !dbg !164
%21 = call i64 %fn_phi(ptr %retparam, ptr %19, i64 %20, i32 0, i64 0), !dbg !165
%not_err = icmp eq i64 %21, 0, !dbg !165
%22 = call i1 @llvm.expect.i1(i1 %not_err, i1 true), !dbg !165
br i1 %22, label %after_check, label %assign_optional, !dbg !165
assign_optional: ; preds = %match
store i64 %21, ptr %error_var, align 8, !dbg !164
br label %panic_block, !dbg !164
store i64 %21, ptr %error_var, align 8, !dbg !165
br label %panic_block, !dbg !165
after_check: ; preds = %match
%23 = load ptr, ptr %retparam, align 8, !dbg !164
store ptr %23, ptr %blockret11, align 8, !dbg !164
br label %expr_block.exit, !dbg !164
%23 = load ptr, ptr %retparam, align 8, !dbg !165
store ptr %23, ptr %blockret11, align 8, !dbg !165
br label %expr_block.exit, !dbg !165
expr_block.exit: ; preds = %after_check, %if.then
%24 = load ptr, ptr %blockret11, align 8, !dbg !164
%24 = load ptr, ptr %blockret11, align 8, !dbg !165
store ptr %24, ptr %taddr, align 8
%25 = load ptr, ptr %taddr, align 8
%26 = load i64, ptr %elements8, align 8, !dbg !165
%add = add i64 0, %26, !dbg !165
%size13 = sub i64 %add, 0, !dbg !165
%27 = insertvalue %"char[][]" undef, ptr %25, 0, !dbg !165
%28 = insertvalue %"char[][]" %27, i64 %size13, 1, !dbg !165
br label %noerr_block, !dbg !165
%26 = load i64, ptr %elements8, align 8, !dbg !166
%add = add i64 0, %26, !dbg !166
%size13 = sub i64 %add, 0, !dbg !166
%27 = insertvalue %"char[][]" undef, ptr %25, 0, !dbg !166
%28 = insertvalue %"char[][]" %27, i64 %size13, 1, !dbg !166
br label %noerr_block, !dbg !166
panic_block: ; preds = %assign_optional
%29 = insertvalue %any undef, ptr %error_var, 0, !dbg !165
%30 = insertvalue %any %29, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1, !dbg !165
%29 = insertvalue %any undef, ptr %error_var, 0, !dbg !166
%30 = insertvalue %any %29, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1, !dbg !166
store %any %30, ptr %varargslots, align 16
%31 = insertvalue %"any[]" undef, ptr %varargslots, 0
%"$$temp" = insertvalue %"any[]" %31, i64 1, 1
store %"any[]" %"$$temp", ptr %indirectarg, align 8
call void @std.core.builtin.panicf(ptr @.panic_msg.1
unreachable, !dbg !152
unreachable, !dbg !153
noerr_block: ; preds = %expr_block.exit
store %"char[][]" %28, ptr %list5, align 8, !dbg !152
!166
store i32 0, ptr %i, align 4, !dbg !169
br label %loop.cond, !dbg !169
store %"char[][]" %28, ptr %list5, align 8, !dbg !153
!167
store i32 0, ptr %i, align 4, !dbg !170
br label %loop.cond, !dbg !170
loop.cond: ; preds = %loop.exit, %noerr_block
%32 = load i32, ptr %i, align 4, !dbg !170
%33 = load i32, ptr %argc2, align 4, !dbg !171
%lt = icmp slt i32 %32, %33, !dbg !170
br i1 %lt, label %loop.body, label %loop.exit26, !dbg !170
%32 = load i32, ptr %i, align 4, !dbg !171
%33 = load i32, ptr %argc2, align 4, !dbg !172
%lt = icmp slt i32 %32, %33, !dbg !171
br i1 %lt, label %loop.body, label %loop.exit26, !dbg !171
loop.body: ; preds = %loop.cond
!172
%34 = load ptr, ptr %argv3, align 8, !dbg !175
%35 = load i32, ptr %i, align 4, !dbg !176
%sext14 = sext i32 %35 to i64, !dbg !176
%ptroffset = getelementptr inbounds [8 x i8], ptr %34, i64 %sext14, !dbg !176
%36 = load ptr, ptr %ptroffset, align 8, !dbg !176
store ptr %36, ptr %arg, align 8, !dbg !176
!177
store i64 0, ptr %len, align 8, !dbg !179
%37 = load ptr, ptr %list5, align 8, !dbg !180
%38 = load i32, ptr %i, align 4, !dbg !181
%sext15 = sext i32 %38 to i64, !dbg !181
%ptroffset16 = getelementptr inbounds [16 x i8], ptr %37, i64 %sext15, !dbg !181
%39 = load ptr, ptr %arg, align 8, !dbg !182
!173
%34 = load ptr, ptr %argv3, align 8, !dbg !176
%35 = load i32, ptr %i, align 4, !dbg !177
%sext14 = sext i32 %35 to i64, !dbg !177
%ptroffset = getelementptr inbounds [8 x i8], ptr %34, i64 %sext14, !dbg !177
%36 = load ptr, ptr %ptroffset, align 8, !dbg !177
store ptr %36, ptr %arg, align 8, !dbg !177
!178
store i64 0, ptr %len, align 8, !dbg !180
%37 = load ptr, ptr %list5, align 8, !dbg !181
%38 = load i32, ptr %i, align 4, !dbg !182
%sext15 = sext i32 %38 to i64, !dbg !182
%ptroffset16 = getelementptr inbounds [16 x i8], ptr %37, i64 %sext15, !dbg !182
%39 = load ptr, ptr %arg, align 8, !dbg !183
%40 = load ptr, ptr %arg, align 8
store ptr %40, ptr %ptr, align 8
!183
store i64 0, ptr %len18, align 8, !dbg !187
br label %loop.cond19, !dbg !188
!184
store i64 0, ptr %len18, align 8, !dbg !188
br label %loop.cond19, !dbg !189
loop.cond19: ; preds = %loop.body21, %loop.body
%41 = load ptr, ptr %ptr, align 8, !dbg !189
%42 = load i64, ptr %len18, align 8, !dbg !191
%ptradd20 = getelementptr inbounds i8, ptr %41, i64 %42, !dbg !191
%43 = load i8, ptr %ptradd20, align 1, !dbg !191
%intbool = icmp ne i8 %43, 0, !dbg !191
br i1 %intbool, label %loop.body21, label %loop.exit, !dbg !191
%41 = load ptr, ptr %ptr, align 8, !dbg !190
%42 = load i64, ptr %len18, align 8, !dbg !192
%ptradd20 = getelementptr inbounds i8, ptr %41, i64 %42, !dbg !192
%43 = load i8, ptr %ptradd20, align 1, !dbg !192
%intbool = icmp ne i8 %43, 0, !dbg !192
br i1 %intbool, label %loop.body21, label %loop.exit, !dbg !192
loop.body21: ; preds = %loop.cond19
%44 = load i64, ptr %len18, align 8, !dbg !192
%add22 = add i64 %44, 1, !dbg !192
store i64 %add22, ptr %len18, align 8, !dbg !192
br label %loop.cond19, !dbg !192
%44 = load i64, ptr %len18, align 8, !dbg !193
%add22 = add i64 %44, 1, !dbg !193
store i64 %add22, ptr %len18, align 8, !dbg !193
br label %loop.cond19, !dbg !193
loop.exit: ; preds = %loop.cond19
%45 = load i64, ptr %len18, align 8, !dbg !193
%add23 = add i64 0, %45, !dbg !193
%size24 = sub i64 %add23, 0, !dbg !193
%46 = insertvalue %"char[]" undef, ptr %39, 0, !dbg !193
%47 = insertvalue %"char[]" %46, i64 %size24, 1, !dbg !193
store %"char[]" %47, ptr %ptroffset16, align 8, !dbg !193
%48 = load i32, ptr %i, align 4, !dbg !194
%add25 = add i32 %48, 1, !dbg !194
store i32 %add25, ptr %i, align 4, !dbg !194
br label %loop.cond, !dbg !194
%45 = load i64, ptr %len18, align 8, !dbg !194
%add23 = add i64 0, %45, !dbg !194
%size24 = sub i64 %add23, 0, !dbg !194
%46 = insertvalue %"char[]" undef, ptr %39, 0, !dbg !194
%47 = insertvalue %"char[]" %46, i64 %size24, 1, !dbg !194
store %"char[]" %47, ptr %ptroffset16, align 8, !dbg !194
%48 = load i32, ptr %i, align 4, !dbg !195
%add25 = add i32 %48, 1, !dbg !195
store i32 %add25, ptr %i, align 4, !dbg !195
br label %loop.cond, !dbg !195
loop.exit26: ; preds = %loop.cond
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %list, ptr align 8 %list5, i32 16, i1 false), !dbg !195
%lo = load ptr, ptr %list, align 8, !dbg !196
%ptradd27 = getelementptr inbounds i8, ptr %list, i64 8, !dbg !196
%hi = load i64, ptr %ptradd27, align 8, !dbg !196
%49 = call i32 @test.main(ptr %lo, i64 %hi), !dbg !197
store i32 %49, ptr %blockret, align 4, !dbg !197
%50 = load ptr, ptr %list, align 8, !dbg !198
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %list, ptr align 8 %list5, i32 16, i1 false), !dbg !196
%lo = load ptr, ptr %list, align 8, !dbg !197
%ptradd27 = getelementptr inbounds i8, ptr %list, i64 8, !dbg !197
%hi = load i64, ptr %ptradd27, align 8, !dbg !197
%49 = call i32 @test.main(ptr %lo, i64 %hi), !dbg !198
store i32 %49, ptr %blockret, align 4, !dbg !198
%50 = load ptr, ptr %list, align 8, !dbg !199
call void @std.core.mem.free(ptr %50)
br label %expr_block.exit28, !dbg !200
br label %expr_block.exit28, !dbg !201
expr_block.exit28: ; preds = %loop.exit26
%51 = load i32, ptr %blockret, align 4, !dbg !200
ret i32 %51, !dbg !200
%51 = load i32, ptr %blockret, align 4, !dbg !201
ret i32 %51, !dbg !201
}
declare { i32, ptr } @attach.to_scope() #0
@@ -545,7 +553,6 @@ declare ptr @std.core.mem.calloc(i64) #0
declare ptr @std.io.stdout() #0
declare i64 @std.io.fprintf(ptr, i64, ptr, ptr, i64, ptr byval(%"any[]") align 8) #0
declare i1 @llvm.expect.i1(i1, i1)
declare i64 @std.io.File.write_byte(ptr, i8 zeroext) #0
@@ -582,106 +589,107 @@ no_match: ; preds = %compare
%9 = load ptr, ptr %8, align 8
br label %check
}
!llvm.dbg.cu = !{!4}
!0 = !{i32 2, !"Dwarf Version", i32 4}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = !{i32 2, !"frame-pointer", i32 2}
!3 = !{i32 1, !"uwtable", i32 2}
!4 = distinct !DICompileUnit(language: DW_LANG_C11
!5 = !DIFile(filename: "defer_macro.c3"
!6 = !{!7}
!7 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "Attach_Arg_Kind", scope: !8, file: !5, line: 116, baseType: !13, size: 32, align: 32, elements: !14)
!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "Attach_Arg", scope: !5, file: !5, line: 120, size: 128, align: 64, elements: !9, identifier: "attach.Attach_Arg")
!9 = !{!10, !11}
!10 = !DIDerivedType(tag: DW_TAG_member, name: "kind", scope: !8, file: !5, line: 121, baseType: !7, size: 32, align: 32)
!11 = !DIDerivedType(tag: DW_TAG_member, name: "box", scope: !8, file: !5, line: 122, baseType: !12, size: 64, align: 64, offset: 64)
!12 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "void*", baseType: null, size: 64, align: 64, dwarfAddressSpace: 0)
!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!14 = !{!15}
!15 = !DIEnumerator(name: "TOP", value: 0)
!16 = distinct !DISubprogram(name: "foo", linkageName: "test.foo", scope: !5, file: !5, line: 6, type: !17, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition
!17 = !DISubroutineType(types: !18)
!18 = !{null, !13}
!19 = !{}
!20 = !DILocalVariable(name: "x", arg: 1, scope: !16, file: !5, line: 6, type: !13)
!21 = !DILocation(line: 6, column: 17, scope: !16)
!22 = !DILocalVariable(name: "a", scope: !16, file: !5, line: 8, type: !13, align: 4)
!23 = !DILocation(line: 8, column: 7, scope: !16)
!24 = !DILocation(line: 8, column: 11, scope: !16)
!25 = !DILocation(line: 9, column: 2, scope: !16)
!26 = !DILocation(line: 9, column: 9, scope: !27)
!27 = distinct !DILexicalBlock(scope: !16, file: !5, line: 9, column: 2)
!28 = !DILocation(line: 11, column: 7, scope: !29)
!29 = distinct !DILexicalBlock(scope: !27, file: !5, line: 10, column: 2)
!30 = distinct !DISubprogram(name: "main", linkageName: "test.main", scope: !5, file: !5, line: 15, type: !31, scopeLine: 15, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition
!31 = !DISubroutineType(types: !32)
!32 = !{!13, !33}
!33 = !DICompositeType(tag: DW_TAG_structure_type, name: "String[]", size: 128, align: 64, elements: !34, identifier: "String[]")
!34 = !{!35, !46}
!35 = !DIDerivedType(tag: DW_TAG_member, name: "ptr", scope: !33, baseType: !36, size: 64, align: 64)
!36 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "String*", baseType: !37, size: 64, align: 64, dwarfAddressSpace: 0)
!37 = !DIDerivedType(tag: DW_TAG_typedef, name: "String", baseType: !38)
!38 = !DICompositeType(tag: DW_TAG_structure_type, name: "char[]", size: 128, align: 64, elements: !39, identifier: "char[]")
!39 = !{!40, !43}
!40 = !DIDerivedType(tag: DW_TAG_member, name: "ptr", scope: !38, baseType: !41, size: 64, align: 64)
!41 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char*", baseType: !42, size: 64, align: 64, dwarfAddressSpace: 0)
!42 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char)
!43 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !38, baseType: !44, size: 64, align: 64, offset: 64)
!44 = !DIDerivedType(tag: DW_TAG_typedef, name: "usz", baseType: !45)
!45 = !DIBasicType(name: "ulong", size: 64, encoding: DW_ATE_unsigned)
!46 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !33, baseType: !44, size: 64, align: 64, offset: 64)
!47 = !DILocalVariable(name: "args", arg: 1, scope: !30, file: !5, line: 15, type: !33)
!48 = !DILocation(line: 15, column: 22, scope: !30)
!49 = !DILocalVariable(name: "asdf", scope: !30, file: !5, line: 18, type: !50, align: 8)
!50 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "Foo*", baseType: !51, size: 64, align: 64, dwarfAddressSpace: 0)
!51 = !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", scope: !5, file: !5, line: 27, size: 64, align: 64, elements: !52, identifier: "test.Foo")
!52 = !{!53}
!53 = !DIDerivedType(tag: DW_TAG_member, name: "asdf", scope: !51, file: !5, line: 28, baseType: !12, size: 64, align: 64)
!54 = !DILocation(line: 18, column: 8, scope: !30)
!55 = !DILocation(line: 18, column: 34, scope: !30)
!56 = !DILocation
!57 = distinct !DISubprogram(name: "[DEFAULT INIT]", linkageName: "[DEFAULT INIT]", scope: !5, file: !5, line: 33, scopeLine: 33, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
!58 = !DILocation(line: 18, column: 15, scope: !30)
!59 = !DILocation(line: 21, column: 8, scope: !30)
!60 = !DILocation(line: 21, column: 42, scope: !30)
!61 = !DILocation(line: 21, column: 3, scope: !30)
!62 = !DILocation(line: 23, column: 3, scope: !30)
!63 = !DILocation(line: 24, column: 10, scope: !30)
!64 = distinct !DISubprogram(name: "create_foo", linkageName: "test.create_foo", scope: !5, file: !5, line: 33, type: !65, scopeLine: 33, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !4, retainedNodes: !19)
!65 = !DISubroutineType(types: !66)
!66 = !{!50, !8, !45, !37}
!67 = !DILocalVariable(name: "attach", arg: 1, scope: !64, file: !5, line: 33, type: !8)
!68 = !DILocation(line: 33, column: 31, scope: !64)
!69 = !DILocalVariable(name: "flags", arg: 2, scope: !64, file: !5, line: 33, type: !45)
!70 = !DILocation(line: 33, column: 49, scope: !64)
!71 = !DILocalVariable(name: "name", arg: 3, scope: !64, file: !5, line: 33, type: !37)
!72 = !DILocation(line: 33, column: 63, scope: !64)
!73 = !DILocation(line:
!74 = distinct !DISubprogram(name: "new", linkageName: "new", scope: !75, file: !75, line: 597, scopeLine: 597, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !4)
!75 = !DIFile(filename: "mem.c3"
!76 = !DILocation(line: 34, column: 15, scope: !64)
!77 = distinct !DISubprogram(name: "test", linkageName: "test.test", scope: !5, file: !5, line: 41, type: !78, scopeLine: 41, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !4, retainedNodes: !19)
!78 = !DISubroutineType(types: !79)
!79 = !{!50, !80}
!80 = !DIDerivedType(tag: DW_TAG_typedef, name: "Color", scope: !5, file: !5, line: 79, baseType: !81, align: 16)
!81 = !DICompositeType(tag: DW_TAG_array_type, baseType: !82, size: 128, align: 32, flags: DIFlagVector, elements: !83)
!82 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
!83 = !{!84}
!84 = !DISubrange(count: 4, lowerBound: 0)
!85 = !DILocalVariable(name: "color", arg: 1, scope: !77, file: !5, line: 41, type: !80)
!86 = !DILocation(line: 41, column: 20, scope: !77)
!87 = !DILocation
!88 = distinct !DISubprogram(name: "printn", linkageName: "printn"
!89 = !DIFile(filename: "io.c3"
!90 = !DILocation(line: 42, column: 7, scope: !77)
!91 = !DILocalVariable(name: "len"
!92 = distinct !DISubprogram(name: "fprintn", linkageName: "fprintn", scope: !89, file: !89, line: 166, scopeLine: 166, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !4, retainedNodes: !19)
!93 = !DILocation
!llvm.dbg.cu = !{!5}
!0 = !{i32 4, !"PIC Level", i32 2}
!1 = !{i32 2, !"Dwarf Version", i32 4}
!2 = !{i32 2, !"Debug Info Version", i32 3}
!3 = !{i32 2, !"frame-pointer", i32 2}
!4 = !{i32 1, !"uwtable", i32 2}
!5 = distinct !DICompileUnit(language: DW_LANG_C11
!6 = !DIFile(filename: "defer_macro.c3"
!7 = !{!8}
!8 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "Attach_Arg_Kind", scope: !9, file: !6, line: 116, baseType: !14, size: 32, align: 32, elements: !15)
!9 = !DICompositeType(tag: DW_TAG_structure_type, name: "Attach_Arg", scope: !6, file: !6, line: 120, size: 128, align: 64, elements: !10, identifier: "attach.Attach_Arg")
!10 = !{!11, !12}
!11 = !DIDerivedType(tag: DW_TAG_member, name: "kind", scope: !9, file: !6, line: 121, baseType: !8, size: 32, align: 32)
!12 = !DIDerivedType(tag: DW_TAG_member, name: "box", scope: !9, file: !6, line: 122, baseType: !13, size: 64, align: 64, offset: 64)
!13 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "void*", baseType: null, size: 64, align: 64, dwarfAddressSpace: 0)
!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!15 = !{!16}
!16 = !DIEnumerator(name: "TOP", value: 0)
!17 = distinct !DISubprogram(name: "foo", linkageName: "test.foo", scope: !6, file: !6, line: 6, type: !18, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !20)
!18 = !DISubroutineType(types: !19)
!19 = !{null, !14}
!20 = !{}
!21 = !DILocalVariable(name: "x", arg: 1, scope: !17, file: !6, line: 6, type: !14)
!22 = !DILocation(line: 6, column: 17, scope: !17)
!23 = !DILocalVariable(name: "a", scope: !17, file: !6, line: 8, type: !14, align: 4)
!24 = !DILocation(line: 8, column: 7, scope: !17)
!25 = !DILocation(line: 8, column: 11, scope: !17)
!26 = !DILocation(line: 9, column: 2, scope: !17)
!27 = !DILocation(line: 9, column: 9, scope: !28)
!28 = distinct !DILexicalBlock(scope: !17, file: !6, line: 9, column: 2)
!29 = !DILocation(line: 11, column: 7, scope: !30)
!30 = distinct !DILexicalBlock(scope: !28, file: !6, line: 10, column: 2)
!31 = distinct !DISubprogram(name: "main", linkageName: "test.main", scope: !6, file: !6, line: 15, type: !32, scopeLine: 15, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !20)
!32 = !DISubroutineType(types: !33)
!33 = !{!14, !34}
!34 = !DICompositeType(tag: DW_TAG_structure_type, name: "String[]", size: 128, align: 64, elements: !35, identifier: "String[]")
!35 = !{!36, !47}
!36 = !DIDerivedType(tag: DW_TAG_member, name: "ptr", scope: !34, baseType: !37, size: 64, align: 64)
!37 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "String*", baseType: !38, size: 64, align: 64, dwarfAddressSpace: 0)
!38 = !DIDerivedType(tag: DW_TAG_typedef, name: "String", baseType: !39)
!39 = !DICompositeType(tag: DW_TAG_structure_type, name: "char[]", size: 128, align: 64, elements: !40, identifier: "char[]")
!40 = !{!41, !44}
!41 = !DIDerivedType(tag: DW_TAG_member, name: "ptr", scope: !39, baseType: !42, size: 64, align: 64)
!42 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char*", baseType: !43, size: 64, align: 64, dwarfAddressSpace: 0)
!43 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char)
!44 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !39, baseType: !45, size: 64, align: 64, offset: 64)
!45 = !DIDerivedType(tag: DW_TAG_typedef, name: "usz", baseType: !46)
!46 = !DIBasicType(name: "ulong", size: 64, encoding: DW_ATE_unsigned)
!47 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !34, baseType: !45, size: 64, align: 64, offset: 64)
!48 = !DILocalVariable(name: "args", arg: 1, scope: !31, file: !6, line: 15, type: !34)
!49 = !DILocation(line: 15, column: 22, scope: !31)
!50 = !DILocalVariable(name: "asdf", scope: !31, file: !6, line: 18, type: !51, align: 8)
!51 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "Foo*", baseType: !52, size: 64, align: 64, dwarfAddressSpace: 0)
!52 = !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", scope: !6, file: !6, line: 27, size: 64, align: 64, elements: !53, identifier: "test.Foo")
!53 = !{!54}
!54 = !DIDerivedType(tag: DW_TAG_member, name: "asdf", scope: !52, file: !6, line: 28, baseType: !13, size: 64, align: 64)
!55 = !DILocation(line: 18, column: 8, scope: !31)
!56 = !DILocation(line: 18, column: 34, scope: !31)
!57 = !DILocation
!58 = distinct !DISubprogram(name: "[DEFAULT INIT]", linkageName: "[DEFAULT INIT]", scope: !6, file: !6, line: 33, scopeLine: 33, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5)
!59 = !DILocation(line: 18, column: 15, scope: !31)
!60 = !DILocation(line: 21, column: 8, scope: !31)
!61 = !DILocation(line: 21, column: 42, scope: !31)
!62 = !DILocation(line: 21, column: 3, scope: !31)
!63 = !DILocation(line: 23, column: 3, scope: !31)
!64 = !DILocation(line: 24, column: 10, scope: !31)
!65 = distinct !DISubprogram(name: "create_foo", linkageName: "test.create_foo", scope: !6, file: !6, line: 33, type: !66, scopeLine: 33, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !20)
!66 = !DISubroutineType(types: !67)
!67 = !{!51, !9, !46, !38}
!68 = !DILocalVariable(name: "attach", arg: 1, scope: !65, file: !6, line: 33, type: !9)
!69 = !DILocation(line: 33, column: 31, scope: !65)
!70 = !DILocalVariable(name: "flags", arg: 2, scope: !65, file: !6, line: 33, type: !46)
!71 = !DILocation(line: 33, column: 49, scope: !65)
!72 = !DILocalVariable(name: "name", arg: 3, scope: !65, file: !6, line: 33, type: !38)
!73 = !DILocation(line: 33, column: 63, scope: !65)
!74 = !DILocation(line:
!75 = distinct !DISubprogram(name: "new", linkageName: "new", scope: !76, file: !76, line: 597, scopeLine: 597, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5)
!76 = !DIFile(filename: "mem.c3"
!77 = !DILocation(line: 34, column: 15, scope: !65)
!78 = distinct !DISubprogram(name: "test", linkageName: "test.test", scope: !6, file: !6, line: 41, type: !79, scopeLine: 41, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !20)
!79 = !DISubroutineType(types: !80)
!80 = !{!51, !81}
!81 = !DIDerivedType(tag: DW_TAG_typedef, name: "Color", scope: !6, file: !6, line: 79, baseType: !82, align: 16)
!82 = !DICompositeType(tag: DW_TAG_array_type, baseType: !83, size: 128, align: 32, flags: DIFlagVector, elements: !84)
!83 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
!84 = !{!85}
!85 = !DISubrange(count: 4, lowerBound: 0)
!86 = !DILocalVariable(name: "color", arg: 1, scope: !78, file: !6, line: 41, type: !81)
!87 = !DILocation(line: 41, column: 20, scope: !78)
!88 = !DILocation
!89 = distinct !DISubprogram(name: "printn", linkageName: "printn"
!90 = !DIFile(filename: "io.c3"
!91 = !DILocation(line: 42, column: 7, scope: !78)
!92 = !DILocalVariable(name: "len"
!93 = distinct !DISubprogram(name: "fprintn", linkageName: "fprintn", scope: !90, file: !90, line: 166, scopeLine: 166, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5, retainedNodes: !20)
!94 = !DILocation
!95 = !DILocation
!96 = distinct !DISubprogram(name: "fprint", linkageName: "fprint"
!97 = !DILocation
!96 = !DILocation
!97 = distinct !DISubprogram(name: "fprint", linkageName: "fprint", scope: !90, file: !90, line: 114, scopeLine: 114, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5)
!98 = !DILocation
!99 = !DILocation
!100 = !DILocation
@@ -689,93 +697,93 @@ no_match: ; preds = %compare
!102 = !DILocation
!103 = !DILocation
!104 = !DILocation
!105 = distinct !DISubprogram(name: "test2", linkageName: "test.test2", scope: !5, file: !5, line: 48, type: !106, scopeLine: 48, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition
!106 = !DISubroutineType(types: !107)
!107 = !{!12}
!108 = !DILocalVariable(name: "scratch", scope: !109, file: !5, line: 110, type: !110, align: 8)
!109 = distinct !DISubprogram(name: "@scratch", linkageName: "@scratch", scope: !5, file: !5, line: 109, scopeLine: 109, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
!110 = !DICompositeType(tag: DW_TAG_structure_type, name: "Arena_Cursor", scope: !5, file: !5, line: 88, size: 128, align: 64, elements: !111, identifier: "foo__Arena_Cursor")
!111 = !{!112, !117}
!112 = !DIDerivedType(tag: DW_TAG_member, name: "arena", scope: !110, file: !5, line: 89, baseType: !113, size: 64, align: 64)
!113 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "Arena*", baseType: !114, size: 64, align: 64, dwarfAddressSpace: 0)
!114 = !DICompositeType(tag: DW_TAG_structure_type, name: "Arena", scope: !5, file: !5, line: 84, size: 64, align: 64, elements: !115, identifier: "foo__Arena")
!115 = !{!116}
!116 = !DIDerivedType(tag: DW_TAG_member, name: "cursor", scope: !114, file: !5, line: 85, baseType: !44, size: 64, align: 64)
!117 = !DIDerivedType(tag: DW_TAG_member, name: "cursor", scope: !110, file: !5, line: 90, baseType: !44, size: 64, align: 64, offset: 64)
!118 = !DILocation
!119 = !DILocation(line: 50, column: 3, scope: !105)
!120 = !DILocation
!105 = !DILocation
!106 = distinct !DISubprogram(name: "test2", linkageName: "test.test2", scope: !6, file: !6, line: 48, type: !107, scopeLine: 48, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !20)
!107 = !DISubroutineType(types: !108)
!108 = !{!13}
!109 = !DILocalVariable(name: "scratch", scope: !110, file: !6, line: 110, type: !111, align: 8)
!110 = distinct !DISubprogram(name: "@scratch", linkageName: "@scratch", scope: !6, file: !6, line: 109, scopeLine: 109, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5, retainedNodes: !20)
!111 = !DICompositeType(tag: DW_TAG_structure_type, name: "Arena_Cursor", scope: !6, file: !6, line: 88, size: 128, align: 64, elements: !112, identifier: "foo__Arena_Cursor")
!112 = !{!113, !118}
!113 = !DIDerivedType(tag: DW_TAG_member, name: "arena", scope: !111, file: !6, line: 89, baseType: !114, size: 64, align: 64)
!114 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "Arena*", baseType: !115, size: 64, align: 64, dwarfAddressSpace: 0)
!115 = !DICompositeType(tag: DW_TAG_structure_type, name: "Arena", scope: !6, file: !6, line: 84, size: 64, align: 64, elements: !116, identifier: "foo__Arena")
!116 = !{!117}
!117 = !DIDerivedType(tag: DW_TAG_member, name: "cursor", scope: !115, file: !6, line: 85, baseType: !45, size: 64, align: 64)
!118 = !DIDerivedType(tag: DW_TAG_member, name: "cursor", scope: !111, file: !6, line: 90, baseType: !45, size: 64, align: 64, offset: 64)
!119 = !DILocation
!120 = !DILocation(line: 50, column: 3, scope: !106)
!121 = !DILocation
!122 = !DILocalVariable(name: "scratch", scope: !105, file: !5, line: 50, type: !113, align: 8)
!123 = !DILocation(line: 50, column: 21, scope: !105)
!124 = !DILocation
!125 = distinct !DILexicalBlock(scope: !109, file: !5, line: 112, column: 3)
!126 = !DILocalVariable(name: "asdf", scope: !127, file: !5, line: 51, type: !12, align: 8)
!127 = distinct !DILexicalBlock(scope: !105, file: !5, line: 50, column: 30)
!128 = !DILocation(line: 51, column: 11, scope: !127)
!129 = !DILocation(line: 52, column: 12, scope: !127)
!130 = !DILocation
!131 = distinct !DILexicalBlock(scope: !109, file: !5, line: 111, column: 9)
!132 = !DILocation
!133 = distinct !DISubprogram(name: "_$main", linkageName: "main", scope: !5, file: !5, line: 15, type: !134, scopeLine: 15, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !4, retainedNodes: !19)
!134 = !DISubroutineType(types: !135)
!135 = !{!13, !13, !136}
!136 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char**", baseType: !41, size: 64, align: 64
!137 = !DILocalVariable(name: ".anon", arg: 1, scope: !133, file: !5, line: 15, type: !13)
!138 = !DILocation(line: 15, column: 8, scope: !133)
!139 = !DILocalVariable(name: ".anon", arg: 2, scope: !133, file: !5, line: 15, type: !136)
!140 = !DILocalVariable(name: "list", scope: !141, file: !5, line: 45, type: !33, align: 8)
!141 = distinct !DISubprogram(name: "@main_to_int_main_args", linkageName: "@main_to_int_main_args"
!142 = !DIFile(filename: "main_stub.c3"
!143 = !DILocation
!144 = !DILocalVariable(name: "list", scope: !145, file: !5, line: 24, type: !33, align: 8)
!145 = distinct !DISubprogram(name: "args_to_strings", linkageName: "args_to_strings", scope: !142, file: !142, line: 22, scopeLine: 22, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !4, retainedNodes: !19)
!146 = !DILocation
!122 = !DILocation
!123 = !DILocalVariable(name: "scratch", scope: !106, file: !6, line: 50, type: !114, align: 8)
!124 = !DILocation(line: 50, column: 21, scope: !106)
!125 = !DILocation
!126 = distinct !DILexicalBlock(scope: !110, file: !6, line: 112, column: 3)
!127 = !DILocalVariable(name: "asdf", scope: !128, file: !6, line: 51, type: !13, align: 8)
!128 = distinct !DILexicalBlock(scope: !106, file: !6, line: 50, column: 30)
!129 = !DILocation(line: 51, column: 11, scope: !128)
!130 = !DILocation(line: 52, column: 12, scope: !128)
!131 = !DILocation
!132 = distinct !DILexicalBlock(scope: !110, file: !6, line: 111, column: 9)
!133 = !DILocation
!134 = distinct !DISubprogram(name: "_$main", linkageName: "main", scope: !6, file: !6, line: 15, type: !135, scopeLine: 15, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !20)
!135 = !DISubroutineType(types: !136)
!136 = !{!14, !14, !137}
!137 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char**", baseType: !42, size: 64, align: 64, dwarfAddressSpace: 0)
!138 = !DILocalVariable(name: ".anon", arg: 1, scope: !134, file: !6, line: 15, type: !14)
!139 = !DILocation(line: 15, column: 8, scope: !134)
!140 = !DILocalVariable(name: ".anon", arg: 2, scope: !134, file: !6, line: 15, type: !137)
!141 = !DILocalVariable(name: "list", scope: !142, file: !6, line: 45, type: !34, align: 8)
!142 = distinct !DISubprogram(name: "@main_to_int_main_args", linkageName: "@main_to_int_main_args", scope: !143, file: !143, line: 43, scopeLine: 43, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5, retainedNodes: !20)
!143 = !DIFile(filename: "main_stub.c3"
!144 = !DILocation
!145 = !DILocalVariable(name: "list", scope: !146, file: !6, line: 24, type: !34, align: 8)
!146 = distinct !DISubprogram(name: "args_to_strings", linkageName: "args_to_strings", scope: !143, file: !143, line: 22, scopeLine: 22, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5, retainedNodes: !20)
!147 = !DILocation
!148 = !DILocation
!149 = !DILocation
!150 = distinct !DISubprogram(name: "alloc_array_try", linkageName: "alloc_array_try"
!151 = !DIFile(filename: "mem_allocator.c3"
!152 = !DILocation
!153 = distinct !DISubprogram(name: "alloc_array", linkageName: "alloc_array"
!154 = !DILocation
!155 = distinct !DISubprogram(name: "alloc_array", linkageName: "alloc_array"
!156 = !DILocation
!150 = !DILocation
!151 = distinct !DISubprogram(name: "alloc_array_try", linkageName: "alloc_array_try", scope: !152, file: !152, line: 284, scopeLine: 284, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5)
!152 = !DIFile(filename: "mem_allocator.c3"
!153 = !DILocation
!154 = distinct !DISubprogram(name: "alloc_array", linkageName: "alloc_array", scope: !152, file: !152, line: 267, scopeLine: 267, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5)
!155 = !DILocation
!156 = distinct !DISubprogram(name: "alloc_array", linkageName: "alloc_array", scope: !76, file: !76, line: 683, scopeLine: 683, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5)
!157 = !DILocation
!158 = !DILocation
!159 = distinct !DISubprogram(name: "malloc_try", linkageName: "malloc_try", scope: !151, file: !151, line: 60, scopeLine: 60, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !4)
!160 = !DILocation
!159 = !DILocation
!160 = distinct !DISubprogram(name: "malloc_try", linkageName: "malloc_try", scope: !152, file: !152, line: 60, scopeLine: 60, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5)
!161 = !DILocation
!162 = !DILocation
!163 = distinct !DISubprogram(name: "[DEFAULT INIT]", linkageName: "[DEFAULT INIT]", scope: !151, file: !151, line: 28, scopeLine: 28, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !4)
!164 = !DILocation
!163 = !DILocation
!164 = distinct !DISubprogram(name: "[DEFAULT INIT]", linkageName: "[DEFAULT INIT]", scope: !152, file: !152, line: 28, scopeLine: 28, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5)
!165 = !DILocation
!166 = !DILocalVariable(name: "i", scope: !167, file: !5, line: 25, type: !13, align: 4)
!167 = distinct !DILexicalBlock(scope: !145, file: !142, line: 25, column: 2)
!168 = !DILocation
!166 = !DILocation
!167 = !DILocalVariable(name: "i", scope: !168, file: !6, line: 25, type: !14, align: 4)
!168 = distinct !DILexicalBlock(scope: !146, file: !143, line: 25, column: 2)
!169 = !DILocation
!170 = !DILocation
!171 = !DILocation
!172 = !DILocalVariable(name: "arg", scope: !173, file: !5, line: 27, type: !41, align: 8)
!173 = distinct !DILexicalBlock(scope: !167, file: !142, line: 26, column: 2)
!174 = !DILocation
!172 = !DILocation
!173 = !DILocalVariable(name: "arg", scope: !174, file: !6, line: 27, type: !42, align: 8)
!174 = distinct !DILexicalBlock(scope: !168, file: !143, line: 26, column: 2)
!175 = !DILocation
!176 = !DILocation
!177 = !DILocalVariable(name: "len", scope: !173, file: !5, line: 28, type: !44, align: 8)
!178 = !DILocation
!177 = !DILocation
!178 = !DILocalVariable(name: "len", scope: !174, file: !6, line: 28, type: !45, align: 8)
!179 = !DILocation
!180 = !DILocation
!181 = !DILocation
!182 = !DILocation
!183 = !DILocalVariable(name: "len", scope: !184, file: !5, line: 5, type: !44, align: 8)
!184 = distinct !DISubprogram(name: "_strlen", linkageName: "_strlen", scope: !142, file: !142, line: 3, scopeLine: 3, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
!185 = !DILocation
!183 = !DILocation
!184 = !DILocalVariable(name: "len", scope: !185, file: !6, line: 5, type: !45, align: 8)
!185 = distinct !DISubprogram(name: "_strlen", linkageName: "_strlen", scope: !143, file: !143, line: 3, scopeLine: 3, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !5, retainedNodes: !20)
!186 = !DILocation
!187 = !DILocation
!188 = !DILocation
!189 = !DILocation
!190 = distinct !DILexicalBlock(scope: !184, file: !142, line: 6, column: 2)
!191 = !DILocation
!190 = !DILocation
!191 = distinct !DILexicalBlock(scope: !185, file: !143, line: 6, column: 2)
!192 = !DILocation
!193 = !DILocation
!194 = !DILocation
@@ -783,5 +791,6 @@ no_match: ; preds = %compare
!196 = !DILocation
!197 = !DILocation
!198 = !DILocation
!199 = distinct !DILexicalBlock(scope: !141,
!200 = !DILocation
!199 = !DILocation
!200 = distinct !DILexicalBlock(scope: !142, file: !143, line: 46, column: 8)
!201 = !DILocation

View File

@@ -12,7 +12,7 @@ fn void foo(String[] args)
/* #expect: test.ll
define void @test.foo(ptr %0, i64 %1) #0 !dbg !6 {
define void @test.foo(ptr %0, i64 %1) #0 !dbg !7 {
entry:
%args = alloca %"char[][]", align 8
%.anon = alloca i64, align 8
@@ -22,52 +22,49 @@ entry:
store ptr %0, ptr %args, align 8
%ptradd = getelementptr inbounds i8, ptr %args, i64 8
store i64 %1, ptr %ptradd, align 8
!24
!26
%ptradd1 = getelementptr inbounds i8, ptr %args, i64 8, !dbg !28
%2 = load i64, ptr %ptradd1, align 8, !dbg !28
store i64 %2, ptr %.anon, align 8, !dbg !28
!26
store i64 0, ptr %.anon2, align 8, !dbg !28
br label %loop.cond, !dbg !28
%ptradd1 = getelementptr inbounds i8, ptr %args, i64 8, !dbg !29
%2 = load i64, ptr %ptradd1, align 8, !dbg !29
store i64 %2, ptr %.anon, align 8, !dbg !29
store i64 0, ptr %.anon2, align 8, !dbg !29
br label %loop.cond, !dbg !29
loop.cond: ; preds = %loop.body, %entry
%3 = load i64, ptr %.anon2, align 8, !dbg !28
%4 = load i64, ptr %.anon, align 8, !dbg !28
%lt = icmp ult i64 %3, %4, !dbg !28
br i1 %lt, label %loop.body, label %loop.exit, !dbg !28
%3 = load i64, ptr %.anon2, align 8, !dbg !29
%4 = load i64, ptr %.anon, align 8, !dbg !29
%lt = icmp ult i64 %3, %4, !dbg !29
br i1 %lt, label %loop.body, label %loop.exit, !dbg !29
loop.body: ; preds = %loop.cond
!29
%5 = load ptr, ptr %args, align 8, !dbg !32
%6 = load i64, ptr %.anon2, align 8, !dbg !32
%ptroffset = getelementptr inbounds [16 x i8], ptr %5, i64 %6, !dbg !32
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %a, ptr align 8 %ptroffset, i32 16, i1 false), !dbg !32
!33
%ptradd3 = getelementptr inbounds i8, ptr %a, i64 8, !dbg !37
%7 = load i64, ptr %ptradd3, align 8, !dbg !37
%trunc = trunc i64 %7 to i32, !dbg !37
store i32 %trunc, ptr %x, align 4, !dbg !37
%8 = load i64, ptr %.anon2, align 8, !dbg !28
%addnuw = add nuw i64 %8, 1, !dbg !28
store i64 %addnuw, ptr %.anon2, align 8, !dbg !28
br label %loop.cond, !dbg !28
%5 = load ptr, ptr %args, align 8, !dbg !33
%6 = load i64, ptr %.anon2, align 8, !dbg !33
%ptroffset = getelementptr inbounds [16 x i8], ptr %5, i64 %6, !dbg !33
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %a, ptr align 8 %ptroffset, i32 16, i1 false), !dbg !33
%ptradd3 = getelementptr inbounds i8, ptr %a, i64 8, !dbg !38
%7 = load i64, ptr %ptradd3, align 8, !dbg !38
%trunc = trunc i64 %7 to i32, !dbg !38
store i32 %trunc, ptr %x, align 4, !dbg !38
%8 = load i64, ptr %.anon2, align 8, !dbg !29
%addnuw = add nuw i64 %8, 1, !dbg !29
store i64 %addnuw, ptr %.anon2, align 8, !dbg !29
br label %loop.cond, !dbg !29
loop.exit: ; preds = %loop.cond
ret void, !dbg !28
ret void, !dbg !29
}
!24 = !DILocalVariable(name: "args", arg: 1, scope: !6, file: !5, line: 3, type: !9)
!25 = !DILocation(line: 3, column: 22, scope: !6)
!26 = !DILocalVariable(name: ".temp", scope: !27, file: !5, line: 5, type: !20, align: 8)
!27 = distinct !DILexicalBlock(scope: !6, file: !5, line: 5, column: 2)
!28 = !DILocation(line: 5, column: 15, scope: !27)
!29 = !DILocalVariable(name: "a", scope: !30, file: !5, line: 5, type: !13, align: 8)
!30 = distinct !DILexicalBlock(scope: !27, file: !5, line: 6, column: 2)
!31 = !DILocation(line: 5, column: 11, scope: !30)
!32 = !DILocation(line: 5, column: 15, scope: !30)
!33 = !DILocalVariable(name: "x", scope: !34, file: !5, line: 7, type: !35, align: 4)
!34 = distinct !DILexicalBlock(scope: !30, file: !5, line: 6, column: 2)
!35 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!36 = !DILocation(line: 7, column: 7, scope: !34)
!37 = !DILocation(line: 7, column: 11, scope: !34)
!23 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !10, baseType: !21, size: 64, align: 64, offset: 64)
!24 = !{}
!25 = !DILocalVariable(name: "args", arg: 1, scope: !7, file: !6, line: 3, type: !10)
!26 = !DILocation(line: 3, column: 22, scope: !7)
!27 = !DILocalVariable(name: ".temp", scope: !28, file: !6, line: 5, type: !21, align: 8)
!28 = distinct !DILexicalBlock(scope: !7, file: !6, line: 5, column: 2)
!29 = !DILocation(line: 5, column: 15, scope: !28)
!30 = !DILocalVariable(name: "a", scope: !31, file: !6, line: 5, type: !14, align: 8)
!31 = distinct !DILexicalBlock(scope: !28, file: !6, line: 6, column: 2)
!32 = !DILocation(line: 5, column: 11, scope: !31)
!33 = !DILocation(line: 5, column: 15, scope: !31)
!34 = !DILocalVariable(name: "x", scope: !35, file: !6, line: 7, type: !36, align: 4)
!35 = distinct !DILexicalBlock(scope: !31, file: !6, line: 6, column: 2)
!36 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!37 = !DILocation(line: 7, column: 7, scope: !35)
!38 = !DILocation(line: 7, column: 11, scope: !35)