Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C++ (Circle)
CIRCT
Clean
CMake
CMakeScript
COBOL
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Cpp2-cppfront
Crystal
C#
CUDA C++
D
Dart
Elixir
Erlang
Fortran
F#
GLSL
Go
Haskell
HLSL
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Nim
Objective-C
Objective-C++
OCaml
OpenCL C
Pascal
Pony
Python
Racket
Ruby
Rust
Snowball
Scala
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
TypeScript Native
V
Vala
Visual Basic
WASM
Zig
Javascript
GIMPLE
Ygen
llvm source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
clang (assertions trunk)
clang (trunk)
clang 10.0.0
clang 10.0.1
clang 11.0.0
clang 11.0.1
clang 12.0.0
clang 12.0.1
clang 13.0.0
clang 14.0.0
clang 15.0.0
clang 16.0.0
clang 17.0.1
clang 18.1.0
clang 19.1.0
clang 4.0.1
clang 5.0.0
clang 6.0.0
clang 7.0.0
clang 8.0.0
clang 9.0.0
llc (assertions trunk)
llc (trunk)
llc 10.0.0
llc 10.0.1
llc 11.0.0
llc 11.0.1
llc 12.0.0
llc 12.0.1
llc 13.0.0
llc 14.0.0
llc 15.0.0
llc 16.0.0
llc 17.0.1
llc 18.1.0
llc 19.1.0
llc 3.2
llc 3.3
llc 3.9.1
llc 4.0.0
llc 4.0.1
llc 5.0.0
llc 6.0.0
llc 7.0.0
llc 8.0.0
llc 9.0.0
opt (assertions trunk)
opt (trunk)
opt 10.0.0
opt 10.0.1
opt 11.0.0
opt 11.0.1
opt 12.0.0
opt 12.0.1
opt 13.0.0
opt 14.0.0
opt 15.0.0
opt 16.0.0
opt 17.0.1
opt 18.1.0
opt 19.1.0
opt 3.2
opt 3.3
opt 3.9.1
opt 4.0.0
opt 4.0.1
opt 5.0.0
opt 6.0.0
opt 7.0.0
opt 8.0.0
opt 9.0.0
Options
Source code
; ModuleID = 'test' source_filename = "test" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" %Bar = type { i32, i32 } %"[]u8" = type { i8*, i64 } %StackTrace = type { i64, %"[]usize" } %"[]usize" = type { i64*, i64 } @0 = internal unnamed_addr constant %Bar { i32 3, i32 4 }, align 4 ; Function Attrs: nobuiltin noreturn nounwind define internal fastcc void @panic(%"[]u8"* nonnull readonly, %StackTrace*) unnamed_addr #0 !dbg !8 { Entry: %error_return_trace = alloca %StackTrace*, align 8 call void @llvm.dbg.declare(metadata %"[]u8"* %0, metadata !33, metadata !DIExpression()), !dbg !36 store %StackTrace* %1, %StackTrace** %error_return_trace, align 8 call void @llvm.dbg.declare(metadata %StackTrace** %error_return_trace, metadata !34, metadata !DIExpression()), !dbg !37 br label %WhileCond, !dbg !38 WhileCond: ; preds = %WhileCond, %Entry br label %WhileCond, !dbg !38 } ; Function Attrs: nounwind readnone speculatable declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ; Function Attrs: nobuiltin nounwind define void @entry() #2 !dbg !41 { Entry: %array = alloca [10 x %Bar], align 4 %x = alloca %Bar, align 4 %for_index = alloca i64, align 8 %0 = bitcast [10 x %Bar]* %array to i8*, !dbg !60 call void @llvm.memset.p0i8.i64(i8* align 4 %0, i8 -86, i64 80, i1 false), !dbg !60 call void @llvm.dbg.declare(metadata [10 x %Bar]* %array, metadata !45, metadata !DIExpression()), !dbg !60 store i64 0, i64* %for_index, align 8, !dbg !61 call void @llvm.dbg.declare(metadata i64* %for_index, metadata !55, metadata !DIExpression()), !dbg !63 br label %ForCond, !dbg !61 ForCond: ; preds = %Else, %Entry %1 = load i64, i64* %for_index, align 8, !dbg !61 %2 = icmp ne i64 %1, 10, !dbg !61 br i1 %2, label %ForBody, label %ForElse, !dbg !61 ForBody: ; preds = %ForCond %3 = getelementptr inbounds [10 x %Bar], [10 x %Bar]* %array, i64 0, i64 %1, !dbg !61 call void @llvm.dbg.declare(metadata %Bar* %3, metadata !58, metadata !DIExpression()), !dbg !64 %4 = load i64, i64* %for_index, align 8, !dbg !65 %5 = icmp eq i64 %4, 1, !dbg !67 br i1 %5, label %Then, label %Else, !dbg !67 Then: ; preds = %ForBody %6 = bitcast %Bar* %3 to i8*, !dbg !68 %7 = bitcast %Bar* %x to i8*, !dbg !68 call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %7, i8* align 4 %6, i64 8, i1 false), !dbg !68 br label %ForEnd, !dbg !69 Else: ; preds = %ForBody %8 = add nuw i64 %1, 1, !dbg !61 store i64 %8, i64* %for_index, align 8, !dbg !61 br label %ForCond, !dbg !61 ForElse: ; preds = %ForCond call fastcc void @bar2(%Bar* sret %x), !dbg !70 br label %ForEnd, !dbg !71 ForEnd: ; preds = %ForElse, %Then call void @llvm.dbg.declare(metadata %Bar* %x, metadata !59, metadata !DIExpression()), !dbg !72 ret void, !dbg !73 } ; Function Attrs: argmemonly nounwind declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1) #3 ; Function Attrs: argmemonly nounwind declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) #3 ; Function Attrs: nobuiltin nounwind define internal fastcc void @bar2(%Bar* nonnull sret) unnamed_addr #2 !dbg !74 { Entry: call fastcc void @bar(%Bar* sret %0), !dbg !79 ret void, !dbg !81 } ; Function Attrs: nobuiltin nounwind define internal fastcc void @bar(%Bar* nonnull sret) unnamed_addr #2 !dbg !82 { Entry: %1 = bitcast %Bar* %0 to i8*, !dbg !83 call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %1, i8* align 4 bitcast (%Bar* @0 to i8*), i64 8, i1 false), !dbg !83 ret void, !dbg !83 } attributes #0 = { nobuiltin noreturn nounwind "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" } attributes #1 = { nounwind readnone speculatable } attributes #2 = { nobuiltin nounwind "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" } attributes #3 = { argmemonly nounwind } !llvm.module.flags = !{!0} !llvm.dbg.cu = !{!1} !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "zig 0.3.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3) !2 = !DIFile(filename: "test", directory: ".") !3 = !{!4} !4 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "anyerror", baseType: !5, size: 16, align: 16, elements: !6) !5 = !DIBasicType(name: "u16", size: 16, encoding: DW_ATE_unsigned) !6 = !{!7} !7 = !DIEnumerator(name: "(none)", value: 0) !8 = distinct !DISubprogram(name: "panic", scope: !9, file: !9, line: 71, type: !10, isLocal: true, isDefinition: true, scopeLine: 71, isOptimized: false, unit: !1, retainedNodes: !32) !9 = !DIFile(filename: "test.zig", directory: "/home/andy/dev/zig/build") !10 = !DISubroutineType(types: !11) !11 = !{!12, !13, !21} !12 = !DIBasicType(name: "void", encoding: DW_ATE_unsigned) !13 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "*[]const u8", baseType: !14, size: 64, align: 64) !14 = !DICompositeType(tag: DW_TAG_structure_type, name: "[]u8", size: 128, align: 64, elements: !15) !15 = !{!16, !19} !16 = !DIDerivedType(tag: DW_TAG_member, name: "ptr", scope: !14, baseType: !17, size: 64, align: 64) !17 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "*u8", baseType: !18, size: 64, align: 64) !18 = !DIBasicType(name: "u8", size: 8, encoding: DW_ATE_unsigned_char) !19 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !14, baseType: !20, size: 64, align: 64, offset: 64) !20 = !DIBasicType(name: "usize", size: 64, encoding: DW_ATE_unsigned) !21 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "*StackTrace", baseType: !22, size: 64, align: 64) !22 = !DICompositeType(tag: DW_TAG_structure_type, name: "StackTrace", scope: !23, file: !23, line: 1, size: 192, align: 192, elements: !24) !23 = !DIFile(filename: "builtin.zig", directory: "/home/andy/.local/share/zig/stage1/builtin/CeIuKOMF34RVoWuDkBTRQzlqtvFqLxDRMPiOR0o-x0F0IUjud2orfmeHZCFdNf-Z") !24 = !{!25, !26} !25 = !DIDerivedType(tag: DW_TAG_member, name: "index", scope: !22, file: !23, line: 2, baseType: !20, size: 64, align: 64) !26 = !DIDerivedType(tag: DW_TAG_member, name: "instruction_addresses", scope: !22, file: !23, line: 3, baseType: !27, size: 128, align: 128, offset: 64) !27 = !DICompositeType(tag: DW_TAG_structure_type, name: "[]usize", size: 128, align: 64, elements: !28) !28 = !{!29, !31} !29 = !DIDerivedType(tag: DW_TAG_member, name: "ptr", scope: !27, baseType: !30, size: 64, align: 64) !30 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "*usize", baseType: !20, size: 64, align: 64) !31 = !DIDerivedType(tag: DW_TAG_member, name: "len", scope: !27, baseType: !20, size: 64, align: 64, offset: 64) !32 = !{!33, !34} !33 = !DILocalVariable(name: "msg", arg: 1, scope: !8, file: !9, line: 71, type: !14) !34 = !DILocalVariable(name: "error_return_trace", arg: 2, scope: !35, file: !9, line: 71, type: !21) !35 = distinct !DILexicalBlock(scope: !8, file: !9, line: 71, column: 14) !36 = !DILocation(line: 71, column: 14, scope: !8) !37 = !DILocation(line: 71, column: 31, scope: !35) !38 = !DILocation(line: 72, column: 5, scope: !39) !39 = distinct !DILexicalBlock(scope: !40, file: !9, line: 71, column: 82) !40 = distinct !DILexicalBlock(scope: !35, file: !9, line: 71, column: 31) !41 = distinct !DISubprogram(name: "entry", scope: !9, file: !9, type: !42, isLocal: false, isDefinition: true, isOptimized: false, unit: !1, retainedNodes: !44) !42 = !DISubroutineType(types: !43) !43 = !{!12} !44 = !{!45, !55, !58, !59} !45 = !DILocalVariable(name: "array", scope: !46, file: !9, line: 2, type: !47) !46 = distinct !DILexicalBlock(scope: !41, file: !9, line: 1, column: 24) !47 = !DICompositeType(tag: DW_TAG_array_type, baseType: !48, size: 640, align: 640, elements: !53) !48 = !DICompositeType(tag: DW_TAG_structure_type, name: "Bar", scope: !9, file: !9, line: 58, size: 64, align: 64, elements: !49) !49 = !{!50, !52} !50 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !48, file: !9, line: 59, baseType: !51, size: 32, align: 32) !51 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_signed) !52 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !48, file: !9, line: 60, baseType: !51, size: 32, align: 32, offset: 32) !53 = !{!54} !54 = !DISubrange(count: 10) !55 = !DILocalVariable(name: "i", scope: !56, file: !9, line: 3, type: !20) !56 = distinct !DILexicalBlock(scope: !57, file: !9, line: 3, column: 26) !57 = distinct !DILexicalBlock(scope: !46, file: !9, line: 2, column: 5) !58 = !DILocalVariable(name: "elem", scope: !57, file: !9, line: 3, type: !48) !59 = !DILocalVariable(name: "x", scope: !57, file: !9, line: 3, type: !48) !60 = !DILocation(line: 2, column: 5, scope: !46) !61 = !DILocation(line: 3, column: 13, scope: !62) !62 = distinct !DILexicalBlock(scope: !56, file: !9, line: 3, column: 32) !63 = !DILocation(line: 3, column: 32, scope: !56) !64 = !DILocation(line: 3, column: 26, scope: !57) !65 = !DILocation(line: 4, column: 13, scope: !66) !66 = distinct !DILexicalBlock(scope: !62, file: !9, line: 3, column: 35) !67 = !DILocation(line: 4, column: 15, scope: !66) !68 = !DILocation(line: 4, column: 27, scope: !66) !69 = !DILocation(line: 4, column: 21, scope: !66) !70 = !DILocation(line: 5, column: 16, scope: !57) !71 = !DILocation(line: 3, column: 13, scope: !57) !72 = !DILocation(line: 3, column: 5, scope: !57) !73 = !DILocation(line: 1, column: 24, scope: !41) !74 = distinct !DISubprogram(name: "bar2", scope: !9, file: !9, line: 37, type: !75, isLocal: true, isDefinition: true, scopeLine: 37, isOptimized: false, unit: !1, retainedNodes: !78) !75 = !DISubroutineType(types: !76) !76 = !{!48, !77} !77 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "*Bar", baseType: !48, size: 64, align: 64) !78 = !{} !79 = !DILocation(line: 38, column: 15, scope: !80) !80 = distinct !DILexicalBlock(scope: !74, file: !9, line: 37, column: 15) !81 = !DILocation(line: 38, column: 5, scope: !80) !82 = distinct !DISubprogram(name: "bar", scope: !9, file: !9, line: 30, type: !75, isLocal: true, isDefinition: true, scopeLine: 30, isOptimized: false, unit: !1, retainedNodes: !78) !83 = !DILocation(line: 31, column: 5, scope: !84) !84 = distinct !DILexicalBlock(scope: !82, file: !9, line: 30, column: 14)
Become a Patron
Sponsor on GitHub
Donate via PayPal
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
About the author
Statistics
Changelog
Version tree