diff --git a/src/compiler/llvm_codegen_module.c b/src/compiler/llvm_codegen_module.c index 6959e3fa9..dcc297da6 100644 --- a/src/compiler/llvm_codegen_module.c +++ b/src/compiler/llvm_codegen_module.c @@ -71,26 +71,6 @@ void gencontext_begin_module(GenContext *c) LLVMSetModuleDataLayout(c->module, c->target_data); LLVMSetSourceFileName(c->module, c->code_module->name->module, strlen(c->code_module->name->module)); - static const char *pic_level = "PIC Level"; - static const char *pie_level = "PIE Level"; - switch (compiler.platform.reloc_model) - { - case RELOC_BIG_PIE: - llvm_set_module_flag(c, LLVMModuleFlagBehaviorOverride, pie_level, (unsigned)2 /* PIE */, type_uint); - FALLTHROUGH; - case RELOC_BIG_PIC: - llvm_set_module_flag(c, LLVMModuleFlagBehaviorOverride, pic_level, (unsigned)2 /* PIC */, type_uint); - break; - case RELOC_SMALL_PIE: - llvm_set_module_flag(c, LLVMModuleFlagBehaviorOverride, pie_level, (unsigned)1 /* pie */, type_uint); - FALLTHROUGH; - case RELOC_SMALL_PIC: - llvm_set_module_flag(c, LLVMModuleFlagBehaviorOverride, pic_level, (unsigned)1 /* pic */, type_uint); - break; - default: - break; - } - LLVMSetTarget(c->module, compiler.platform.target_triple); // Setup all types. Not thread-safe, but at this point in time we can assume a single context. @@ -146,22 +126,46 @@ void gencontext_begin_module(GenContext *c) c->memcmp_function_type = LLVMFunctionType(llvm_get_type(c, type_cint), memcmp_types, 3, false); if (c->panic_var) c->panic_var->backend_ref = NULL; if (c->panicf) c->panicf->backend_ref = NULL; + bool is_win = compiler.build.arch_os_target == WINDOWS_X64 || compiler.build.arch_os_target == WINDOWS_AARCH64; + llvm_set_module_flag(c, LLVMModuleFlagBehaviorWarning, "Dwarf Version", 4, type_uint); + if (is_win) + { + llvm_set_module_flag(c, LLVMModuleFlagBehaviorError, "CodeView", 1, type_uint); + } + llvm_set_module_flag(c, LLVMModuleFlagBehaviorWarning, "Debug Info Version", 3, type_uint); + llvm_set_module_flag(c, LLVMModuleFlagBehaviorWarning, "wchar_size", is_win ? 2 : 4, type_uint); + static const char *pic_level = "PIC Level"; + static const char *pie_level = "PIE Level"; + switch (compiler.platform.reloc_model) + { + case RELOC_BIG_PIE: + llvm_set_module_flag(c, LLVMModuleFlagBehaviorOverride, pie_level, (unsigned)2 /* PIE */, type_uint); + FALLTHROUGH; + case RELOC_BIG_PIC: + llvm_set_module_flag(c, LLVMModuleFlagBehaviorOverride, pic_level, (unsigned)2 /* PIC */, type_uint); + break; + case RELOC_SMALL_PIE: + llvm_set_module_flag(c, LLVMModuleFlagBehaviorOverride, pie_level, (unsigned)1 /* pie */, type_uint); + FALLTHROUGH; + case RELOC_SMALL_PIC: + llvm_set_module_flag(c, LLVMModuleFlagBehaviorOverride, pic_level, (unsigned)1 /* pic */, type_uint); + break; + default: + break; + } + llvm_set_module_flag(c, LLVMModuleFlagBehaviorError, "uwtable", UWTABLE, type_uint); + if (is_win) + { + llvm_set_module_flag(c, LLVMModuleFlagBehaviorWarning, "MaxTLSAlign", 65536, type_uint); + } + else + { + unsigned frame_pointer = compiler.platform.arch == ARCH_TYPE_AARCH64 ? 1 : 2; + llvm_set_module_flag(c, LLVMModuleFlagBehaviorWarning, "frame-pointer", frame_pointer, type_uint); + } if (compiler.build.debug_info != DEBUG_INFO_NONE) { - if (compiler.build.arch_os_target == WINDOWS_X64 || compiler.build.arch_os_target == WINDOWS_AARCH64) - { - llvm_set_module_flag(c, LLVMModuleFlagBehaviorError, "CodeView", 1, type_uint); - } - else - { - unsigned frame_pointer = compiler.platform.arch == ARCH_TYPE_AARCH64 ? 1 : 2; - llvm_set_module_flag(c, LLVMModuleFlagBehaviorWarning, "Dwarf Version", 4, type_uint); - llvm_set_module_flag(c, LLVMModuleFlagBehaviorWarning, "Debug Info Version", 3, type_uint); - llvm_set_module_flag(c, LLVMModuleFlagBehaviorWarning, "frame-pointer", frame_pointer, type_uint); - } - llvm_set_module_flag(c, LLVMModuleFlagBehaviorError, "uwtable", UWTABLE, type_uint); - c->debug.runtime_version = 0; c->debug.builder = LLVMCreateDIBuilder(c->module); if (compiler.build.debug_info == DEBUG_INFO_FULL && safe_mode_enabled()) diff --git a/test/test_suite/concurrency/atomic_load_store_debug.c3t b/test/test_suite/concurrency/atomic_load_store_debug.c3t index fdec63c98..f742cd8ef 100644 --- a/test/test_suite/concurrency/atomic_load_store_debug.c3t +++ b/test/test_suite/concurrency/atomic_load_store_debug.c3t @@ -22,11 +22,12 @@ fn void main() /* #expect: test.ll %.introspect = type { i8, i64, ptr, i64, i64, i64, [0 x i64] } %any = type { ptr, i64 } + @"$ct.test.Ghh" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 12, i64 0, i64 3, [0 x i64] zeroinitializer }, align 8 @.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 -define void @test.main() #0 !dbg !7 { +define void @test.main() #0 !dbg !8 { entry: %a = alloca i32, align 4 %x = alloca i32, align 4 @@ -39,37 +40,37 @@ entry: %value6 = alloca i32, align 4 %varargslots = alloca [1 x %any], align 16 %retparam = alloca i64, align 8 - store i32 111, ptr %a, align 4, !dbg !14 + store i32 111, ptr %a, align 4, !dbg !15 store ptr %a, ptr %x1, align 8 - %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 + %0 = load ptr, ptr %x1, align 8, !dbg !18 + %1 = load atomic i32, ptr %0 seq_cst, align 4, !dbg !18 + store i32 %1, ptr %x, align 4, !dbg !18 store ptr %a, ptr %x2, align 8 - %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 + %2 = load ptr, ptr %x2, align 8, !dbg !24 + %3 = load atomic volatile i32, ptr %2 monotonic, align 4, !dbg !24 + store i32 %3, ptr %y, align 4, !dbg !24 store ptr %a, ptr %x3, align 8 - %4 = load i32, ptr %x, align 4, !dbg !26 - %add = add i32 123, %4, !dbg !27 + %4 = load i32, ptr %x, align 4, !dbg !27 + %add = add i32 123, %4, !dbg !28 store i32 %add, ptr %value, align 4 - %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 + %5 = load ptr, ptr %x3, align 8, !dbg !29 + %6 = load i32, ptr %value, align 4, !dbg !29 + store atomic i32 %6, ptr %5 seq_cst, align 4, !dbg !29 store ptr %a, ptr %x4, align 8 - %7 = load i32, ptr %y, align 4, !dbg !31 - %add5 = add i32 33, %7, !dbg !32 + %7 = load i32, ptr %y, align 4, !dbg !32 + %add5 = add i32 33, %7, !dbg !33 store i32 %add5, ptr %value6, align 4 - %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 + %8 = load ptr, ptr %x4, align 8, !dbg !34 + %9 = load i32, ptr %value6, align 4, !dbg !34 + store atomic volatile i32 %9, ptr %8 monotonic, align 4, !dbg !34 + %10 = insertvalue %any undef, ptr %a, 0, !dbg !37 + %11 = insertvalue %any %10, i64 ptrtoint (ptr @"$ct.int" to i64), 1, !dbg !37 + store %any %11, ptr %varargslots, align 16, !dbg !37 + %12 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1), !dbg !38 + ret void, !dbg !38 } -define i32 @main(i32 %0, ptr %1) #0 !dbg !38 { +define i32 @main(i32 %0, ptr %1) #0 !dbg !39 { entry: %.anon = alloca i32, align 4 %.anon1 = alloca ptr, align 8 @@ -81,65 +82,66 @@ entry: 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 !47 - ret i32 0, !dbg !50 + call void @test.main(), !dbg !48 + ret i32 0, !dbg !51 } declare extern_weak i64 @std.io.printfn(ptr, ptr, i64, ptr, i64) #0 -declare i1 @llvm.expect.i1(i1, i1) +declare i1 @llvm.expect.i1(i1, i1) #2 -!llvm.module.flags = !{!0, !1, !2, !3, !4} -!llvm.dbg.cu = !{!5} +!llvm.module.flags = !{!0, !1, !2, !3, !4, !5} +!llvm.dbg.cu = !{!6} -!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} +!0 = !{i32 2, !"Dwarf Version", i32 4} +!1 = !{i32 2, !"Debug Info Version", i32 3} +!2 = !{i32 2, !"wchar_size", i32 4} +!3 = !{i32 4, !"PIC Level", 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( \ No newline at end of file +!5 = !{i32 2, !"frame-pointer", i32 2} +!6 = distinct !DICompileUnit(language: DW_LANG_C11, file: !7, producer: "c3c", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false) +!7 = !DIFile(filename: "atomic_load_store_debug.c3" +!8 = distinct !DISubprogram(name: "main", linkageName: "test.main", scope: !7, file: !7, line: 10, type: !9, scopeLine: 10, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !11) +!9 = !DISubroutineType(types: !10) +!10 = !{null} +!11 = !{} +!12 = !DILocalVariable(name: "a", scope: !8, file: !7, line: 12, type: !13, align: 4) +!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!14 = !DILocation(line: 12, column: 6, scope: !8) +!15 = !DILocation(line: 12, column: 10, scope: !8) +!16 = !DILocalVariable(name: "x", scope: !8, file: !7, line: 13, type: !13, align: 4) +!17 = !DILocation(line: 13, column: 6, scope: !8) +!18 = !DILocation( +!19 = distinct !DISubprogram(name: "@atomic_load", +!20 = !DIFile(filename: "mem.c3", +!21 = !DILocation(line: 13, column: 10, scope: !8) +!22 = !DILocalVariable(name: "y", scope: !8, file: !7, line: 14, type: !13, align: 4) +!23 = !DILocation(line: 14, column: 6, scope: !8) +!24 = !DILocation( +!25 = distinct !DISubprogram(name: "@atomic_load", linkageName: "@atomic_load", scope: !20, file: !20, line: 225, scopeLine: 225, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6) +!26 = !DILocation(line: 14, column: 10, scope: !8) +!27 = !DILocation(line: 15, column: 25, scope: !8) +!28 = !DILocation(line: 15, column: 19, scope: !8) +!29 = !DILocation( +!30 = distinct !DISubprogram(name: "@atomic_store", linkageName: "@atomic_store", scope: !20, file: !20, line: 240, scopeLine: 240, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6) +!31 = !DILocation(line: 15, column: 2, scope: !8) +!32 = !DILocation(line: 16, column: 24, scope: !8) +!33 = !DILocation(line: 16, column: 19, scope: !8) +!34 = !DILocation( +!35 = distinct !DISubprogram(name: "@atomic_store", linkageName: "@atomic_store", scope: !20, file: !20, line: 240, scopeLine: 240, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6) +!36 = !DILocation(line: 16, column: 2, scope: !8) +!37 = !DILocation(line: 17, column: 20, scope: !8) +!38 = !DILocation(line: 17, column: 6, scope: !8) +!39 = distinct !DISubprogram(name: "_$main", linkageName: "main", scope: !7, file: !7, line: 10, type: !40, scopeLine: 10, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !11) +!40 = !DISubroutineType(types: !41) +!41 = !{!13, !13, !42} +!42 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char**", baseType: !43, size: 64, align: 64, dwarfAddressSpace: 0) +!43 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char*", baseType: !44, size: 64, align: 64, dwarfAddressSpace: 0) +!44 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char) +!45 = !DILocalVariable(name: ".anon", arg: 1, scope: !39, file: !7, line: 10, type: !13) +!46 = !DILocation(line: 10, column: 9, scope: !39) +!47 = !DILocalVariable(name: ".anon", arg: 2, scope: !39, file: !7, line: 10, type: !42) +!48 = !DILocation( +!49 = distinct !DISubprogram(name: "@main_to_void_main", linkageName: "@main_to_void_main", scope: !50, file: !50, line: 16, scopeLine: 16, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6) +!50 = !DIFile(filename: "main_stub.c3", directory: +!51 = !DILocation( diff --git a/test/test_suite/debug_symbols/constants.c3t b/test/test_suite/debug_symbols/constants.c3t index 146c4a632..05bff4463 100644 --- a/test/test_suite/debug_symbols/constants.c3t +++ b/test/test_suite/debug_symbols/constants.c3t @@ -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, !15} -!llvm.dbg.cu = !{!16} +!llvm.module.flags = !{!11, !12, !13, !14, !15, !16} +!llvm.dbg.cu = !{!17} !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) !1 = distinct !DIGlobalVariable(name: "AA", linkageName: "constants.AA", scope: !2 @@ -26,10 +26,11 @@ 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 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} +!11 = !{i32 2, !"Dwarf Version", i32 4} +!12 = !{i32 2, !"Debug Info Version", i32 3} +!13 = !{i32 2, !"wchar_size", i32 4} +!14 = !{i32 4, !"PIC Level", 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} \ No newline at end of file +!16 = !{i32 2, !"frame-pointer", i32 2} +!17 = distinct !DICompileUnit(language: DW_LANG_C11, file: !2, producer: "c3c", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !18, splitDebugInlining: false) +!18 = !{!0, !4, !6, !9} diff --git a/test/test_suite/debug_symbols/constants_mingw.c3t b/test/test_suite/debug_symbols/constants_mingw.c3t index e382a71cd..9c5fedc84 100644 --- a/test/test_suite/debug_symbols/constants_mingw.c3t +++ b/test/test_suite/debug_symbols/constants_mingw.c3t @@ -14,12 +14,12 @@ 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, !15} -!llvm.dbg.cu = !{!16} +!llvm.module.flags = !{!11, !12, !13, !14, !15, !16} +!llvm.dbg.cu = !{!17} !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) -!2 = !DIFile(filename: "constants_mingw.c3", directory: +!2 = !DIFile(filename: "constants_mingw.c3", directory !3 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char) !4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression()) !5 = distinct !DIGlobalVariable(name: "BB", linkageName: "constants_mingw.BB", scope: !2, file: !2, line: 2, type: !3, isLocal: false, isDefinition: true, align: 1) @@ -28,10 +28,11 @@ 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 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} +!11 = !{i32 2, !"Dwarf Version", i32 4} +!12 = !{i32 2, !"Debug Info Version", i32 3} +!13 = !{i32 2, !"wchar_size", i32 4} +!14 = !{i32 4, !"PIC Level", 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} \ No newline at end of file +!16 = !{i32 2, !"frame-pointer", i32 2} +!17 = distinct !DICompileUnit(language: DW_LANG_C11, file: !2, producer: "c3c", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !18, splitDebugInlining: false) +!18 = !{!0, !4, !6, !9} diff --git a/test/test_suite/debug_symbols/ct_foreach.c3t b/test/test_suite/debug_symbols/ct_foreach.c3t index cf6b039d4..5cb6a032b 100644 --- a/test/test_suite/debug_symbols/ct_foreach.c3t +++ b/test/test_suite/debug_symbols/ct_foreach.c3t @@ -16,46 +16,48 @@ fn void main() { /* #expect: test.ll -define void @test.foo() #0 !dbg !7 { + +define void @test.foo() #0 !dbg !8 { entry: %values = alloca [1 x i32], align 4 - store i32 0, ptr %values, align 4, !dbg !16 store i32 0, ptr %values, align 4, !dbg !17 - ret void, !dbg !17 + store i32 0, ptr %values, align 4, !dbg !18 + ret void, !dbg !18 } -!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} +!0 = !{i32 2, !"Dwarf Version", i32 4} +!1 = !{i32 2, !"Debug Info Version", i32 3} +!2 = !{i32 2, !"wchar_size", i32 4} +!3 = !{i32 4, !"PIC Level", 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) +!5 = !{i32 2, !"frame-pointer", i32 2} +!6 = distinct !DICompileUnit +!7 = !DIFile(filename: +!8 = distinct !DISubprogram(name: "foo", linkageName: "test.foo", scope: !7, file: !7, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !11) +!9 = !DISubroutineType(types: !10) +!10 = !{null} +!11 = !{} +!12 = !DILocalVariable(name: "values", scope: !8 +!13 = !DICompositeType(tag: DW_TAG_array_type, baseType: !14, size: 32, align: 32, elements: !15) +!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!15 = !{!16} +!16 = !DISubrange(count: 1, lowerBound: 0) +!17 = !DILocation(line: 5, column: 10, scope: !8) +!18 = !DILocation(line: 7, column: 18, scope: !19) +!19 = distinct !DILexicalBlock(scope: !20, file: !7, line: 6, column: 3) +!20 = distinct !DILexicalBlock(scope: !8, file: !7, line: 6, column: 3) +!21 = distinct !DISubprogram(name: "main", linkageName: "test.main", scope: !7, file: !7, line: 11, type: !9, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6) +!22 = !DILocation(line: 12, column: 3, scope: !21) +!23 = distinct !DISubprogram(name: "_$main", linkageName: "main", scope: !7, file: !7, line: 11, type: !24, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !11) +!24 = !DISubroutineType(types: !25) +!25 = !{!14, !14, !26} +!26 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char**", baseType: !27, size: 64, align: 64, dwarfAddressSpace: 0) +!27 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char*", baseType: !28, size: 64, align: 64, dwarfAddressSpace: 0) +!28 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char) +!29 = !DILocalVariable(name: ".anon", arg: 1, scope: !23, file: !7, line: 11, type: !14) +!30 = !DILocation(line: 11, column: 9, scope: !23) +!31 = !DILocalVariable(name: ".anon", arg: 2, scope: !23, file: !7, line: 11, type: !26) +!32 = !DILocation(line: 18, column: 2, scope: !33, inlinedAt: !30) +!33 = distinct !DISubprogram(name: "@main_to_void_main", linkageName: "@main_to_void_main", scope: !34, file: !34, line: 16, scopeLine: 16, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6) +!34 = !DIFile(filename: "main_stub.c3" +!35 = !DILocation(line: 19, column: 9, scope: !33, inlinedAt: !30) diff --git a/test/test_suite/debug_symbols/defer_macro.c3t b/test/test_suite/debug_symbols/defer_macro.c3t index 0d5024b10..446075765 100644 --- a/test/test_suite/debug_symbols/defer_macro.c3t +++ b/test/test_suite/debug_symbols/defer_macro.c3t @@ -133,35 +133,35 @@ fn Attach_Arg to_scope() @inline { /* #expect: test.ll -define void @test.foo(i32 %0) #0 !dbg !17 { +define void @test.foo(i32 %0) #0 !dbg !18 { entry: %x = alloca i32, align 4 %a = alloca i32, align 4 %a.f = alloca i64, align 8 store i32 %0, ptr %x, align 4 - !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 + !25 + %1 = load i32, ptr %x, align 4, !dbg !26 + store i32 %1, ptr %a, align 4, !dbg !26 + store i64 0, ptr %a.f, align 8, !dbg !26 + br label %loop.cond, !dbg !27 loop.cond: ; preds = %loop.body, %entry - %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 + %load.err = load i64, ptr %a.f, align 8, !dbg !28 + %result = icmp eq i64 %load.err, 0, !dbg !28 + br i1 %result, label %loop.body, label %loop.exit, !dbg !28 loop.body: ; preds = %loop.cond - 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 + store i32 2, ptr %a, align 4, !dbg !30 + store i64 0, ptr %a.f, align 8, !dbg !30 + br label %loop.cond, !dbg !30 loop.exit: ; preds = %loop.cond - ret void, !dbg !29 + ret void, !dbg !30 } ; Function Attrs: nounwind uwtable -define i32 @test.main(ptr %0, i64 %1) #0 !dbg !31 { +define i32 @test.main(ptr %0, i64 %1) #0 !dbg !32 { entry: %args = alloca %"char[][]", align 8 %asdf = alloca ptr, align 8 @@ -169,25 +169,26 @@ entry: store ptr %0, ptr %args, align 8 %ptradd = getelementptr inbounds i8, ptr %args, i64 8 store i64 %1, ptr %ptradd, align 8 - !48 !50 - %2 = call { i32, ptr } @attach.to_scope() + !56 + %2 = call { i32, ptr } @attach.to_scope() #4, !dbg !57 store { i32, ptr } %2, ptr %result, align 8 - %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> , <4 x float> - %5 = call ptr @test.test(<4 x float> %ternary), !dbg !62 - %6 = call ptr @test.test2(), !dbg !63 - ret i32 0, !dbg !64 + %lo = load i32, ptr %result, align 8, !dbg !58 + %ptradd1 = getelementptr inbounds i8, ptr %result, i64 8, !dbg !58 + %hi = load ptr, ptr %ptradd1, align 8, !dbg !58 + %3 = call ptr @test.create_foo(i32 %lo, ptr %hi, i64 1, ptr null, i64 0), !dbg !60 + store ptr %3, ptr %asdf, align 8, !dbg !60 + %ptradd2 = getelementptr inbounds i8, ptr %args, i64 8, !dbg !61 + %4 = load i64, ptr %ptradd2, align 8, !dbg !61 + %neq = icmp ne i64 0, %4, !dbg !61 + %ternary = select i1 %neq, <4 x float> , <4 x float> , !dbg !62 + %5 = call ptr @test.test(<4 x float> %ternary), !dbg !63 + %6 = call ptr @test.test2(), !dbg !64 + ret i32 0, !dbg !65 } -define ptr @test.create_foo(i32 %0, ptr %1, i64 %2, ptr %3, i64 %4) #0 !dbg !65 { + +define ptr @test.create_foo(i32 %0, ptr %1, i64 %2, ptr %3, i64 %4) #0 !dbg !66 { entry: %attach = alloca %Attach_Arg, align 8 %flags = alloca i64, align 8 @@ -195,18 +196,18 @@ entry: store i32 %0, ptr %attach, align 8 %ptradd = getelementptr inbounds i8, ptr %attach, i64 8 store ptr %1, ptr %ptradd, align 8 - !68 - store i64 %2, ptr %flags, align 8 !70 + store i64 %2, ptr %flags, align 8 + !72 store ptr %3, ptr %name, align 8 %ptradd1 = getelementptr inbounds i8, ptr %name, i64 8 store i64 %4, ptr %ptradd1, align 8 - - %5 = call ptr @std.core.mem.calloc(i64 8) - ret ptr %5, !dbg !74 + !74 + %5 = call ptr @std.core.mem.calloc(i64 8) #4, !dbg !75 + ret ptr %5, !dbg !75 } -define ptr @test.test(<4 x float> %0) #0 !dbg !78 { +define ptr @test.test(<4 x float> %0) #0 !dbg !79 { entry: %color = alloca <4 x float>, align 16 %x = alloca <4 x float>, align 16 @@ -223,92 +224,92 @@ entry: %error_var5 = alloca i64, align 8 %error_var11 = alloca i64, align 8 store <4 x float> %0, ptr %color, align 16 - !86 + !88 %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 !88 + %2 = call ptr @std.io.stdout(), !dbg !89 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 - !92 + !95 %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 !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 + %6 = load ptr, ptr %out2, align 8, !dbg !97 + %7 = insertvalue %any undef, ptr %6, 0, !dbg !97 + %8 = insertvalue %any %7, i64 ptrtoint (ptr @"$ct.std.io.File" to i64), 1, !dbg !97 + %9 = insertvalue %any undef, ptr %x3, 0, !dbg !100 + %10 = insertvalue %any %9, i64 ptrtoint (ptr @"$ct.foo.Color" to i64), 1, !dbg !100 + store %any %10, ptr %varargslots, align 16, !dbg !100 + %11 = insertvalue %"any[]" undef, ptr %varargslots, 0, !dbg !100 + %"$$temp" = insertvalue %"any[]" %11, i64 1, 1, !dbg !100 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 !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 + %12 = call i64 @std.io.fprintf(ptr %retparam, i64 %lo, ptr %hi, ptr @.str, i64 2, ptr byval(%"any[]") align 8 %indirectarg), !dbg !101 + %not_err = icmp eq i64 %12, 0, !dbg !101 + %13 = call i1 @llvm.expect.i1(i1 %not_err, i1 true), !dbg !101 + br i1 %13, label %after_check, label %assign_optional, !dbg !101 assign_optional: ; preds = %entry - store i64 %12, ptr %error_var, align 8, !dbg !100 - br label %guard_block, !dbg !100 + store i64 %12, ptr %error_var, align 8, !dbg !101 + br label %guard_block, !dbg !101 after_check: ; preds = %entry - br label %noerr_block, !dbg !100 + br label %noerr_block, !dbg !101 guard_block: ; preds = %assign_optional - br label %voiderr, !dbg !100 + br label %voiderr, !dbg !101 noerr_block: ; preds = %after_check - %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 + %14 = load i64, ptr %retparam, align 8, !dbg !101 + store i64 %14, ptr %len, align 8, !dbg !101 + %15 = load ptr, ptr %out, align 8, !dbg !102 + %16 = call i64 @std.io.File.write_byte(ptr %15, i8 zeroext 10), !dbg !103 + %not_err6 = icmp eq i64 %16, 0, !dbg !103 + %17 = call i1 @llvm.expect.i1(i1 %not_err6, i1 true), !dbg !103 + br i1 %17, label %after_check8, label %assign_optional7, !dbg !103 assign_optional7: ; preds = %noerr_block - store i64 %16, ptr %error_var5, align 8, !dbg !102 - br label %guard_block9, !dbg !102 + store i64 %16, ptr %error_var5, align 8, !dbg !103 + br label %guard_block9, !dbg !103 after_check8: ; preds = %noerr_block - br label %noerr_block10, !dbg !102 + br label %noerr_block10, !dbg !103 guard_block9: ; preds = %assign_optional7 - br label %voiderr, !dbg !102 + br label %voiderr, !dbg !103 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 + %18 = load ptr, ptr %out, align 8, !dbg !104 + %19 = call i64 @std.io.File.flush(ptr %18), !dbg !104 + %not_err12 = icmp eq i64 %19, 0, !dbg !104 + %20 = call i1 @llvm.expect.i1(i1 %not_err12, i1 true), !dbg !104 + br i1 %20, label %after_check14, label %assign_optional13, !dbg !104 assign_optional13: ; preds = %noerr_block10 - store i64 %19, ptr %error_var11, align 8, !dbg !103 - br label %guard_block15, !dbg !103 + store i64 %19, ptr %error_var11, align 8, !dbg !104 + br label %guard_block15, !dbg !104 after_check14: ; preds = %noerr_block10 - br label %noerr_block16, !dbg !103 + br label %noerr_block16, !dbg !104 guard_block15: ; preds = %assign_optional13 - br label %voiderr, !dbg !103 + br label %voiderr, !dbg !104 noerr_block16: ; preds = %after_check14 - %21 = load i64, ptr %len, align 8, !dbg !104 - %add = add i64 %21, 1, !dbg !104 - br label %voiderr, !dbg !95 + %21 = load i64, ptr %len, align 8, !dbg !105 + %add = add i64 %21, 1, !dbg !105 + br label %voiderr, !dbg !96 voiderr: ; preds = %noerr_block16, %guard_block15, %guard_block9, %guard_block - ret ptr null, !dbg !105 + ret ptr null, !dbg !106 } -define ptr @test.test2() #0 !dbg !106 { +define ptr @test.test2() #0 !dbg !107 { entry: %conflicts = alloca %"Arena*[]", align 8 %scratch = alloca %Arena_Cursor, align 8 @@ -316,27 +317,27 @@ entry: %scratch1 = alloca ptr, align 8 %asdf = alloca ptr, align 8 store %"Arena*[]" zeroinitializer, ptr %conflicts, align 8 - !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 + !120 + %lo = load ptr, ptr %conflicts, align 8, !dbg !122 + %ptradd = getelementptr inbounds i8, ptr %conflicts, i64 8, !dbg !122 + %hi = load i64, ptr %ptradd, align 8, !dbg !122 + %0 = call { ptr, i64 } @arena_scratch_begin(ptr %lo, i64 %hi), !dbg !123 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) - !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 !133 + !125 + %1 = load ptr, ptr %scratch, align 8, !dbg !126 + store ptr %1, ptr %scratch1, align 8, !dbg !126 + !130 + store ptr null, ptr %asdf, align 8, !dbg !130 + %2 = load ptr, ptr %asdf, align 8, !dbg !131 + %lo2 = load ptr, ptr %scratch, align 8, !dbg !132 + %ptradd3 = getelementptr inbounds i8, ptr %scratch, i64 8, !dbg !132 + %hi4 = load i64, ptr %ptradd3, align 8, !dbg !132 + call void @arena_scratch_end(ptr %lo2, i64 %hi4) #4, !dbg !134 + ret ptr %2, !dbg !134 } -define i32 @main(i32 %0, ptr %1) #0 !dbg !134 { +define i32 @main(i32 %0, ptr %1) #0 !dbg !135 { entry: %.anon = alloca i32, align 4 %.anon1 = alloca ptr, align 8 @@ -369,21 +370,21 @@ entry: %len18 = alloca i64, align 8 store ptr null, ptr %.cachedtype, align 8 store i32 %0, ptr %.anon, align 4 - !138 + !140 store ptr %1, ptr %.anon1, align 8 !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 - !141 + !145 %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 - !145 - %6 = load i32, ptr %argc2, align 4, !dbg !149 - %sext = sext i32 %6 to i64, !dbg !149 + !148 + %6 = load i32, ptr %argc2, align 4, !dbg !150 + %sext = sext i32 %6 to i64, !dbg !150 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 @@ -392,21 +393,21 @@ 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 !150 - %mul = mul i64 16, %9, !dbg !158 + %9 = load i64, ptr %elements8, align 8, !dbg !151 + %mul = mul i64 16, %9, !dbg !159 store i64 %mul, ptr %size, align 8 - %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 + %10 = load i64, ptr %size, align 8, !dbg !160 + %not = icmp eq i64 %10, 0, !dbg !160 + br i1 %not, label %if.then, label %if.exit, !dbg !160 if.then: ; preds = %entry - store ptr null, ptr %blockret11, align 8, !dbg !162 - br label %expr_block.exit, !dbg !162 + store ptr null, ptr %blockret11, align 8, !dbg !163 + br label %expr_block.exit, !dbg !163 if.exit: ; preds = %entry - %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 + %ptradd = getelementptr inbounds i8, ptr %allocator10, i64 8, !dbg !164 + %11 = load i64, ptr %ptradd, align 8, !dbg !164 + %12 = inttoptr i64 %11 to ptr, !dbg !164 %type = load ptr, ptr %.cachedtype, align 8 %13 = icmp eq ptr %12, %type br i1 %13, label %cache_hit, label %cache_miss @@ -429,130 +430,135 @@ cache_hit: ; preds = %if.exit br i1 %17, label %missing_function, label %match missing_function: ; preds = %16 - %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 + %18 = load ptr, ptr @std.core.builtin.panic, align 8, !dbg !166 + call void %18(ptr @.panic_msg, i64 44, ptr @.file, i64 16, ptr @.func, i64 6, i32 68), !dbg !166 + unreachable, !dbg !166 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 !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 + %21 = call i64 %fn_phi(ptr %retparam, ptr %19, i64 %20, i32 0, i64 0), !dbg !166 + %not_err = icmp eq i64 %21, 0, !dbg !166 + %22 = call i1 @llvm.expect.i1(i1 %not_err, i1 true), !dbg !166 + br i1 %22, label %after_check, label %assign_optional, !dbg !166 assign_optional: ; preds = %match - store i64 %21, ptr %error_var, align 8, !dbg !165 - br label %panic_block, !dbg !165 + store i64 %21, ptr %error_var, align 8, !dbg !166 + br label %panic_block, !dbg !166 after_check: ; preds = %match - %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 + %23 = load ptr, ptr %retparam, align 8, !dbg !166 + store ptr %23, ptr %blockret11, align 8, !dbg !166 + br label %expr_block.exit, !dbg !166 expr_block.exit: ; preds = %after_check, %if.then - %24 = load ptr, ptr %blockret11, align 8, !dbg !165 + %24 = load ptr, ptr %blockret11, align 8, !dbg !166 store ptr %24, ptr %taddr, align 8 %25 = load ptr, ptr %taddr, align 8 - %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 + %26 = load i64, ptr %elements8, align 8, !dbg !167 + %add = add i64 0, %26, !dbg !167 + %size13 = sub i64 %add, 0, !dbg !167 + %27 = insertvalue %"char[][]" undef, ptr %25, 0, !dbg !167 + %28 = insertvalue %"char[][]" %27, i64 %size13, 1, !dbg !167 + br label %noerr_block, !dbg !167 panic_block: ; preds = %assign_optional - %29 = insertvalue %any undef, ptr %error_var, 0, !dbg !166 - %30 = insertvalue %any %29, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1, !dbg !166 + %29 = insertvalue %any undef, ptr %error_var, 0, !dbg !167 + %30 = insertvalue %any %29, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1, !dbg !167 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 !153 + unreachable, !dbg !154 noerr_block: ; preds = %expr_block.exit - 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 + store %"char[][]" %28, ptr %list5, align 8, !dbg !154 + !170 + store i32 0, ptr %i, align 4, !dbg !171 + br label %loop.cond, !dbg !171 loop.cond: ; preds = %loop.exit, %noerr_block - %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 + %32 = load i32, ptr %i, align 4, !dbg !172 + %33 = load i32, ptr %argc2, align 4, !dbg !173 + %lt = icmp slt i32 %32, %33, !dbg !172 + br i1 %lt, label %loop.body, label %loop.exit26, !dbg !172 loop.body: ; preds = %loop.cond - !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 + !176 + %34 = load ptr, ptr %argv3, align 8, !dbg !177 + %35 = load i32, ptr %i, align 4, !dbg !178 + %sext14 = sext i32 %35 to i64, !dbg !178 + %ptroffset = getelementptr inbounds [8 x i8], ptr %34, i64 %sext14, !dbg !178 + %36 = load ptr, ptr %ptroffset, align 8, !dbg !178 + store ptr %36, ptr %arg, align 8, !dbg !178 + !180 + store i64 0, ptr %len, align 8, !dbg !181 + %37 = load ptr, ptr %list5, align 8, !dbg !182 + %38 = load i32, ptr %i, align 4, !dbg !183 + %sext15 = sext i32 %38 to i64, !dbg !183 + %ptroffset16 = getelementptr inbounds [16 x i8], ptr %37, i64 %sext15, !dbg !183 + %39 = load ptr, ptr %arg, align 8, !dbg !184 %40 = load ptr, ptr %arg, align 8 store ptr %40, ptr %ptr, align 8 - !184 - store i64 0, ptr %len18, align 8, !dbg !188 - br label %loop.cond19, !dbg !189 + !187 + store i64 0, ptr %len18, align 8, !dbg !189 + br label %loop.cond19, !dbg !190 loop.cond19: ; preds = %loop.body21, %loop.body - %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 + %41 = load ptr, ptr %ptr, align 8, !dbg !191 + %42 = load i64, ptr %len18, align 8, !dbg !193 + %ptradd20 = getelementptr inbounds i8, ptr %41, i64 %42, !dbg !193 + %43 = load i8, ptr %ptradd20, align 1, !dbg !193 + %intbool = icmp ne i8 %43, 0, !dbg !193 + br i1 %intbool, label %loop.body21, label %loop.exit, !dbg !193 loop.body21: ; preds = %loop.cond19 - %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 + %44 = load i64, ptr %len18, align 8, !dbg !194 + %add22 = add i64 %44, 1, !dbg !194 + store i64 %add22, ptr %len18, align 8, !dbg !194 + br label %loop.cond19, !dbg !194 loop.exit: ; preds = %loop.cond19 - %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 + %45 = load i64, ptr %len18, align 8, !dbg !195 + %add23 = add i64 0, %45, !dbg !195 + %size24 = sub i64 %add23, 0, !dbg !195 + %46 = insertvalue %"char[]" undef, ptr %39, 0, !dbg !195 + %47 = insertvalue %"char[]" %46, i64 %size24, 1, !dbg !195 + store %"char[]" %47, ptr %ptroffset16, align 8, !dbg !195 + %48 = load i32, ptr %i, align 4, !dbg !196 + %add25 = add i32 %48, 1, !dbg !196 + store i32 %add25, ptr %i, align 4, !dbg !196 + br label %loop.cond, !dbg !196 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 !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 @llvm.memcpy.p0.p0.i32(ptr align 8 %list, ptr align 8 %list5, i32 16, i1 false), !dbg !197 + %lo = load ptr, ptr %list, align 8, !dbg !198 + %ptradd27 = getelementptr inbounds i8, ptr %list, i64 8, !dbg !198 + %hi = load i64, ptr %ptradd27, align 8, !dbg !198 + %49 = call i32 @test.main(ptr %lo, i64 %hi), !dbg !199 + store i32 %49, ptr %blockret, align 4, !dbg !199 + %50 = load ptr, ptr %list, align 8, !dbg !200 call void @std.core.mem.free(ptr %50) - br label %expr_block.exit28, !dbg !201 + br label %expr_block.exit28, !dbg !202 expr_block.exit28: ; preds = %loop.exit26 - %51 = load i32, ptr %blockret, align 4, !dbg !201 - ret i32 %51, !dbg !201 + %51 = load i32, ptr %blockret, align 4, !dbg !202 + ret i32 %51, !dbg !202 } declare { i32, ptr } @attach.to_scope() #0 declare extern_weak ptr @std.core.mem.calloc(i64) #0 + declare extern_weak ptr @std.io.stdout() #0 + declare extern_weak i64 @std.io.fprintf(ptr, i64, ptr, ptr, i64, ptr byval(%"any[]") align 8) #0 + declare extern_weak i64 @std.io.File.write_byte(ptr, i8 zeroext) #0 + declare extern_weak i64 @std.io.File.flush(ptr) #0 + declare { ptr, i64 } @arena_scratch_begin(ptr, i64) #0 declare void @arena_scratch_end(ptr, i64) #0 @@ -585,107 +591,107 @@ no_match: ; preds = %compare br label %check } -!llvm.dbg.cu = !{!5} +!llvm.dbg.cu = !{!6} -!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} +!0 = !{i32 2, !"Dwarf Version", i32 4} +!1 = !{i32 2, !"Debug Info Version", i32 3} +!2 = !{i32 2, !"wchar_size", i32 4} +!3 = !{i32 4, !"PIC Level", 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 -!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 -!94 = !DILocation +!5 = !{i32 2, !"frame-pointer", i32 2} +!6 = distinct !DICompileUnit(language: DW_LANG_C11 +!7 = !DIFile(filename: "defer_macro.c3" +!8 = !{!9} +!9 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "Attach_Arg_Kind", scope: !10, file: !7, line: 116, baseType: !15, size: 32, align: 32, elements: !16) +!10 = !DICompositeType(tag: DW_TAG_structure_type, name: "Attach_Arg", scope: !7, file: !7, line: 120, size: 128, align: 64, elements: !11, identifier: "attach.Attach_Arg") +!11 = !{!12, !13} +!12 = !DIDerivedType(tag: DW_TAG_member, name: "kind", scope: !10, file: !7, line: 121, baseType: !9, size: 32, align: 32) +!13 = !DIDerivedType(tag: DW_TAG_member, name: "box", scope: !10, file: !7, line: 122, baseType: !14, size: 64, align: 64, offset: 64) +!14 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "void*", baseType: null, size: 64, align: 64, dwarfAddressSpace: 0) +!15 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!16 = !{!17} +!17 = !DIEnumerator(name: "TOP", value: 0) +!18 = distinct !DISubprogram(name: "foo", linkageName: "test.foo", scope: !7, file: !7, line: 6, type: !19, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !21) +!19 = !DISubroutineType(types: !20) +!20 = !{null, !15} +!21 = !{} +!22 = !DILocalVariable(name: "x", arg: 1, scope: !18, file: !7, line: 6, type: !15) +!23 = !DILocation(line: 6, column: 17, scope: !18) +!24 = !DILocalVariable(name: "a", scope: !18, file: !7, line: 8, type: !15, align: 4) +!25 = !DILocation(line: 8, column: 7, scope: !18) +!26 = !DILocation(line: 8, column: 11, scope: !18) +!27 = !DILocation(line: 9, column: 2, scope: !18) +!28 = !DILocation(line: 9, column: 9, scope: !29) +!29 = distinct !DILexicalBlock(scope: !18, file: !7, line: 9, column: 2) +!30 = !DILocation(line: 11, column: 7, scope: !31) +!31 = distinct !DILexicalBlock(scope: !29, file: !7, line: 10, column: 2) +!32 = distinct !DISubprogram(name: "main", linkageName: "test.main", scope: !7, file: !7, line: 15, type: !33, scopeLine: 15, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !21) +!33 = !DISubroutineType(types: !34) +!34 = !{!15, !35} +!35 = !DICompositeType(tag: DW_TAG_structure_type, name: "String[]", size: 128, align: 64, elements: !36, identifier: "String[]") +!36 = !{!37, !48} +!37 = !DIDerivedType(tag: DW_TAG_member, name: "ptr", scope: !35, baseType: !38, size: 64, align: 64) +!38 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "String*", baseType: !39, size: 64, align: 64, dwarfAddressSpace: 0) +!39 = !DIDerivedType(tag: DW_TAG_typedef, name: "String", baseType: !40) +!40 = !DICompositeType(tag: DW_TAG_structure_type, name: "char[]", size: 128, align: 64, elements: !41, identifier: "char[]") +!41 = !{!42, !45} +!42 = !DIDerivedType(tag: DW_TAG_member, name: "ptr", scope: !40, baseType: !43, size: 64, align: 64) +!43 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char*", baseType: !44, size: 64, align: 64, dwarfAddressSpace: 0) +!44 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char) +!45 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !40, baseType: !46, size: 64, align: 64, offset: 64) +!46 = !DIDerivedType(tag: DW_TAG_typedef, name: "usz", baseType: !47) +!47 = !DIBasicType(name: "ulong", size: 64, encoding: DW_ATE_unsigned) +!48 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !35, baseType: !46, size: 64, align: 64, offset: 64) +!49 = !DILocalVariable(name: "args", arg: 1, scope: !32, file: !7, line: 15, type: !35) +!50 = !DILocation(line: 15, column: 22, scope: !32) +!51 = !DILocalVariable(name: "asdf", scope: !32, file: !7, line: 18, type: !52, align: 8) +!52 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "Foo*", baseType: !53, size: 64, align: 64, dwarfAddressSpace: 0) +!53 = !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", scope: !7, file: !7, line: 27, size: 64, align: 64, elements: !54, identifier: "test.Foo") +!54 = !{!55} +!55 = !DIDerivedType(tag: DW_TAG_member, name: "asdf", scope: !53, file: !7, line: 28, baseType: !14, size: 64, align: 64) +!56 = !DILocation(line: 18, column: 8, scope: !32) +!57 = !DILocation(line: 18, column: 34, scope: !32) +!58 = !DILocation +!59 = distinct !DISubprogram(name: "[DEFAULT INIT]", linkageName: "[DEFAULT INIT]", scope: !7, file: !7, line: 33, scopeLine: 33, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6) +!60 = !DILocation(line: 18, column: 15, scope: !32) +!61 = !DILocation(line: 21, column: 8, scope: !32) +!62 = !DILocation(line: 21, column: 42, scope: !32) +!63 = !DILocation(line: 21, column: 3, scope: !32) +!64 = !DILocation(line: 23, column: 3, scope: !32) +!65 = !DILocation(line: 24, column: 10, scope: !32) +!66 = distinct !DISubprogram(name: "create_foo", linkageName: "test.create_foo", scope: !7, file: !7, line: 33, type: !67, scopeLine: 33, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !21) +!67 = !DISubroutineType(types: !68) +!68 = !{!52, !10, !47, !39} +!69 = !DILocalVariable(name: "attach", arg: 1, scope: !66, file: !7, line: 33, type: !10) +!70 = !DILocation(line: 33, column: 31, scope: !66) +!71 = !DILocalVariable(name: "flags", arg: 2, scope: !66, file: !7, line: 33, type: !47) +!72 = !DILocation(line: 33, column: 49, scope: !66) +!73 = !DILocalVariable(name: "name", arg: 3, scope: !66, file: !7, line: 33, type: !39) +!74 = !DILocation(line: 33, column: 63, scope: !66) +!75 = !DILocation(line: +!76 = distinct !DISubprogram(name: "new", linkageName: "new", scope: !77, file: !77, line: 624, scopeLine: 624, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6) +!77 = !DIFile(filename: "mem.c3" +!78 = !DILocation(line: 34, column: 15, scope: !66) +!79 = distinct !DISubprogram(name: "test", linkageName: "test.test", scope: !7, file: !7, line: 41, type: !80, scopeLine: 41, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !21) +!80 = !DISubroutineType(types: !81) +!81 = !{!52, !82} +!82 = !DIDerivedType(tag: DW_TAG_typedef, name: "Color", scope: !7, file: !7, line: 79, baseType: !83, align: 16) +!83 = !DICompositeType(tag: DW_TAG_array_type, baseType: !84, size: 128, align: 32, flags: DIFlagVector, elements: !85) +!84 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float) +!85 = !{!86} +!86 = !DISubrange(count: 4, lowerBound: 0) +!87 = !DILocalVariable(name: "color", arg: 1, scope: !79, file: !7, line: 41, type: !82) +!88 = !DILocation(line: 41, column: 20, scope: !79) +!89 = !DILocation +!90 = distinct !DISubprogram(name: "printn", linkageName: "printn" +!91 = !DIFile(filename: "io.c3" +!92 = !DILocation(line: 42, column: 7, scope: !79) +!93 = !DILocalVariable(name: "len" +!94 = distinct !DISubprogram(name: "fprintn", linkageName: "fprintn", scope: !91, file: !91, line: 172, scopeLine: 172, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6, retainedNodes: !21) !95 = !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 +!97 = !DILocation +!98 = distinct !DISubprogram(name: "fprint", linkageName: "fprint", scope: !91, file: !91, line: 114, scopeLine: 114, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6) !99 = !DILocation !100 = !DILocation !101 = !DILocation @@ -693,93 +699,93 @@ no_match: ; preds = %compare !103 = !DILocation !104 = !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) +!106 = !DILocation +!107 = distinct !DISubprogram(name: "test2", linkageName: "test.test2", scope: !7, file: !7, line: 48, type: !108, scopeLine: 48, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !21) +!108 = !DISubroutineType(types: !109) +!109 = !{!14} +!110 = !DILocalVariable(name: "scratch", scope: !111, file: !7, line: 110, type: !112, align: 8) +!111 = distinct !DISubprogram(name: "@scratch", linkageName: "@scratch", scope: !7, file: !7, line: 109, scopeLine: 109, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6, retainedNodes: !21) +!112 = !DICompositeType(tag: DW_TAG_structure_type, name: "Arena_Cursor", scope: !7, file: !7, line: 88, size: 128, align: 64, elements: !113, identifier: "foo__Arena_Cursor") +!113 = !{!114, !119} +!114 = !DIDerivedType(tag: DW_TAG_member, name: "arena", scope: !112, file: !7, line: 89, baseType: !115, size: 64, align: 64) +!115 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "Arena*", baseType: !116, size: 64, align: 64, dwarfAddressSpace: 0) +!116 = !DICompositeType(tag: DW_TAG_structure_type, name: "Arena", scope: !7, file: !7, line: 84, size: 64, align: 64, elements: !117, identifier: "foo__Arena") +!117 = !{!118} +!118 = !DIDerivedType(tag: DW_TAG_member, name: "cursor", scope: !116, file: !7, line: 85, baseType: !46, size: 64, align: 64) +!119 = !DIDerivedType(tag: DW_TAG_member, name: "cursor", scope: !112, file: !7, line: 90, baseType: !46, size: 64, align: 64, offset: 64) +!120 = !DILocation(line: 110, column: 16, scope: !111, inlinedAt: !121) !121 = !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 +!123 = !DILocation +!124 = !DILocalVariable(name: "scratch", scope: !107, file: !7, line: 50, type: !115, align: 8) +!125 = !DILocation(line: 50, column: 21, scope: !107) +!126 = !DILocation +!127 = distinct !DILexicalBlock(scope: !111, file: !7, line: 112, column: 3) +!128 = !DILocalVariable(name: "asdf", scope: !129, file: !7, line: 51, type: !14, align: 8) +!129 = distinct !DILexicalBlock(scope: !107, file: !7, line: 50, column: 30) +!130 = !DILocation(line: 51, column: 11, scope: !129) +!131 = !DILocation(line: 52, column: 12, scope: !129) +!132 = !DILocation +!133 = distinct !DILexicalBlock(scope: !111, file: !7, line: 111, column: 9) +!134 = !DILocation +!135 = distinct !DISubprogram(name: "_$main", linkageName: "main", scope: !7, file: !7, line: 15, type: !136, scopeLine: 15, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !21) +!136 = !DISubroutineType(types: !137) +!137 = !{!15, !15, !138} +!138 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "char**", baseType: !43, size: 64, align: 64, dwarfAddressSpace: 0) +!139 = !DILocalVariable(name: ".anon", arg: 1, scope: !135, file: !7, line: 15, type: !15) +!140 = !DILocation(line: 15, column: 8, scope: !135) +!141 = !DILocalVariable(name: ".anon", arg: 2, scope: !135, file: !7, line: 15, type: !138) +!142 = !DILocalVariable(name: "list", scope: !143, file: !7, line: 45, type: !35, align: 8) +!143 = distinct !DISubprogram(name: "@main_to_int_main_args", linkageName: "@main_to_int_main_args", scope: !144, file: !144, line: 43, scopeLine: 43, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6, retainedNodes: !21) +!144 = !DIFile(filename: "main_stub.c3" +!145 = !DILocation +!146 = !DILocalVariable(name: "list", scope: !147, file: !7, line: 24, type: !35, align: 8) +!147 = distinct !DISubprogram(name: "args_to_strings", linkageName: "args_to_strings", scope: !144, file: !144, line: 22, scopeLine: 22, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6, retainedNodes: !21) !148 = !DILocation !149 = !DILocation !150 = !DILocation -!151 = distinct !DISubprogram(name: "alloc_array_try", linkageName: "alloc_array_try" -!152 = !DIFile(filename: "mem_allocator.c3" -!153 = !DILocation -!154 = distinct !DISubprogram(name: "alloc_array", linkageName: "alloc_array" -!155 = !DILocation -!156 = distinct !DISubprogram(name: "alloc_array", linkageName: "alloc_array" -!157 = !DILocation +!151 = !DILocation +!152 = distinct !DISubprogram(name: "alloc_array_try", linkageName: "alloc_array_try", scope: !153, file: !153, line: 284, scopeLine: 284, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6) +!153 = !DIFile(filename: "mem_allocator.c3" +!154 = !DILocation +!155 = distinct !DISubprogram(name: "alloc_array", linkageName: "alloc_array", scope: !153, file: !153, line: 267, scopeLine: 267, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6) +!156 = !DILocation +!157 = distinct !DISubprogram(name: "alloc_array", linkageName: "alloc_array", scope: !77, file: !77, line: 710, scopeLine: 710, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6) !158 = !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 +!160 = !DILocation +!161 = distinct !DISubprogram(name: "malloc_try", linkageName: "malloc_try", scope: !153, file: !153, line: 60, scopeLine: 60, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6) !162 = !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 +!164 = !DILocation +!165 = distinct !DISubprogram(name: "[DEFAULT INIT]", linkageName: "[DEFAULT INIT]", scope: !153, file: !153, line: 28, scopeLine: 28, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6) !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 +!167 = !DILocation +!168 = !DILocalVariable(name: "i", scope: !169, file: !7, line: 25, type: !15, align: 4) +!169 = distinct !DILexicalBlock(scope: !147, file: !144, line: 25, column: 2) !170 = !DILocation !171 = !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 +!173 = !DILocation +!174 = !DILocalVariable(name: "arg", scope: !175, file: !7, line: 27, type: !43, align: 8) +!175 = distinct !DILexicalBlock(scope: !169, file: !144, line: 26, column: 2) !176 = !DILocation !177 = !DILocation -!178 = !DILocalVariable(name: "len", scope: !174, file: !6, line: 28, type: !45, align: 8) -!179 = !DILocation +!178 = !DILocation +!179 = !DILocalVariable(name: "len", scope: !175, file: !7, line: 28, type: !46, align: 8) !180 = !DILocation !181 = !DILocation !182 = !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 +!184 = !DILocation +!185 = !DILocalVariable(name: "len", scope: !186, file: !7, line: 5, type: !46, align: 8) +!186 = distinct !DISubprogram(name: "_strlen", linkageName: "_strlen", scope: !144, file: !144, line: 3, scopeLine: 3, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !6, retainedNodes: !21) !187 = !DILocation !188 = !DILocation !189 = !DILocation !190 = !DILocation -!191 = distinct !DILexicalBlock(scope: !185, file: !143, line: 6, column: 2) -!192 = !DILocation +!191 = !DILocation +!192 = distinct !DILexicalBlock(scope: !186, file: !144, line: 6, column: 2) !193 = !DILocation !194 = !DILocation !195 = !DILocation @@ -787,5 +793,6 @@ no_match: ; preds = %compare !197 = !DILocation !198 = !DILocation !199 = !DILocation -!200 = distinct !DILexicalBlock(scope: !142, file: !143, line: 46, column: 8) -!201 = !DILocation \ No newline at end of file +!200 = !DILocation +!201 = distinct !DILexicalBlock(scope: !143, file: !144, line: 46, column: 8) +!202 = !DILocation \ No newline at end of file diff --git a/test/test_suite/debug_symbols/foreach.c3t b/test/test_suite/debug_symbols/foreach.c3t index 468006859..a56de8d63 100644 --- a/test/test_suite/debug_symbols/foreach.c3t +++ b/test/test_suite/debug_symbols/foreach.c3t @@ -12,7 +12,7 @@ fn void foo(String[] args) /* #expect: test.ll -define void @test.foo(ptr %0, i64 %1) #0 !dbg !7 { +define void @test.foo(ptr %0, i64 %1) #0 !dbg !8 { entry: %args = alloca %"char[][]", align 8 %.anon = alloca i64, align 8 @@ -22,49 +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 - %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 + %ptradd1 = getelementptr inbounds i8, ptr %args, i64 8, !dbg !30 + %2 = load i64, ptr %ptradd1, align 8, !dbg !30 + store i64 %2, ptr %.anon, align 8, !dbg !30 + store i64 0, ptr %.anon2, align 8, !dbg !30 + br label %loop.cond, !dbg !30 loop.cond: ; preds = %loop.body, %entry - %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 + %3 = load i64, ptr %.anon2, align 8, !dbg !30 + %4 = load i64, ptr %.anon, align 8, !dbg !30 + %lt = icmp ult i64 %3, %4, !dbg !30 + br i1 %lt, label %loop.body, label %loop.exit, !dbg !30 loop.body: ; preds = %loop.cond - %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 + %5 = load ptr, ptr %args, align 8, !dbg !34 + %6 = load i64, ptr %.anon2, align 8, !dbg !34 + %ptroffset = getelementptr inbounds [16 x i8], ptr %5, i64 %6, !dbg !34 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %a, ptr align 8 %ptroffset, i32 16, i1 false), !dbg !34 + %ptradd3 = getelementptr inbounds i8, ptr %a, i64 8, !dbg !39 + %7 = load i64, ptr %ptradd3, align 8, !dbg !39 + %trunc = trunc i64 %7 to i32, !dbg !39 + store i32 %trunc, ptr %x, align 4, !dbg !39 + %8 = load i64, ptr %.anon2, align 8, !dbg !30 + %addnuw = add nuw i64 %8, 1, !dbg !30 + store i64 %addnuw, ptr %.anon2, align 8, !dbg !30 + br label %loop.cond, !dbg !30 loop.exit: ; preds = %loop.cond - ret void, !dbg !29 + ret void, !dbg !30 } -!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) \ No newline at end of file +!24 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !11, baseType: !22, size: 64, align: 64, offset: 64) +!25 = !{} +!26 = !DILocalVariable(name: "args", arg: 1, scope: !8, file: !7, line: 3, type: !11) +!27 = !DILocation(line: 3, column: 22, scope: !8) +!28 = !DILocalVariable(name: ".temp", scope: !29, file: !7, line: 5, type: !22, align: 8) +!29 = distinct !DILexicalBlock(scope: !8, file: !7, line: 5, column: 2) +!30 = !DILocation(line: 5, column: 15, scope: !29) +!31 = !DILocalVariable(name: "a", scope: !32, file: !7, line: 5, type: !15, align: 8) +!32 = distinct !DILexicalBlock(scope: !29, file: !7, line: 6, column: 2) +!33 = !DILocation(line: 5, column: 11, scope: !32) +!34 = !DILocation(line: 5, column: 15, scope: !32) +!35 = !DILocalVariable(name: "x", scope: !36, file: !7, line: 7, type: !37, align: 4) +!36 = distinct !DILexicalBlock(scope: !32, file: !7, line: 6, column: 2) +!37 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!38 = !DILocation(line: 7, column: 7, scope: !36) +!39 = !DILocation(line: 7, column: 11, scope: !36)