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
Odin
OpenCL C
Pascal
Pony
Python
Racket
Ruby
Rust
Snowball
Scala
Slang
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
TypeScript Native
V
Vala
Visual Basic
Vyper
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
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define dso_local void @_Z4testPiS_Ps(i32* %0, i32* %1, i16* %2) #0 { %4 = alloca i32*, align 8 %5 = alloca i32*, align 8 %6 = alloca i16*, align 8 %7 = alloca i32, align 4 store i32* %0, i32** %4, align 8, !tbaa !2 store i32* %1, i32** %5, align 8, !tbaa !2 store i16* %2, i16** %6, align 8, !tbaa !2 %8 = bitcast i32* %7 to i8* call void @llvm.lifetime.start.p0i8(i64 4, i8* %8) #4 %9 = load i16*, i16** %6, align 8, !tbaa !2 %10 = load i16, i16* %9, align 2, !tbaa !6 %11 = sext i16 %10 to i32 store i32 %11, i32* %7, align 4, !tbaa !8 %12 = load i32*, i32** %5, align 8, !tbaa !2 store i32 0, i32* %12, align 4, !tbaa !8 %13 = load i32, i32* %7, align 4, !tbaa !8 %14 = trunc i32 %13 to i16 %15 = load i16*, i16** %6, align 8, !tbaa !2 store i16 %14, i16* %15, align 2, !tbaa !6 %16 = bitcast i32* %7 to i8* call void @llvm.lifetime.end.p0i8(i64 4, i8* %16) #4 ret void } declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1 define dso_local i32 @main() #2 { %1 = alloca i32, align 4 %2 = alloca i32, align 4 store i32 0, i32* %1, align 4 %3 = bitcast i32* %2 to i8* call void @llvm.lifetime.start.p0i8(i64 4, i8* %3) #4 store i32 1, i32* %2, align 4, !tbaa !8 %4 = bitcast i32* %2 to i16* call void @_Z4testPiS_Ps(i32* %2, i32* %2, i16* %4) %5 = load i32, i32* %2, align 4, !tbaa !8 %6 = bitcast i32* %2 to i8* %7 = bitcast i32* %2 to i8* call void @llvm.lifetime.end.p0i8(i64 4, i8* %7) #4 ret i32 0 } declare dso_local i32 @printf(i8*, ...) #3 attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false""disable-tail-calls"="false""frame-pointer"="none""less-precise-fpmad"="false""min-legal-vector-width"="0""no-infs-fp-math"="false""no-jump-tables"="false""no-nans-fp-math"="false""no-signed-zeros-fp-math"="false""no-trapping-math"="false""stack-protector-buffer-size"="8""target-cpu"="x86-64""target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87""unsafe-fp-math"="false""use-soft-float"="false" } attributes #1 = { argmemonly nounwind willreturn } attributes #2 = { norecurse uwtable "correctly-rounded-divide-sqrt-fp-math"="false""disable-tail-calls"="false""frame-pointer"="none""less-precise-fpmad"="false""min-legal-vector-width"="0""no-infs-fp-math"="false""no-jump-tables"="false""no-nans-fp-math"="false""no-signed-zeros-fp-math"="false""no-trapping-math"="false""stack-protector-buffer-size"="8""target-cpu"="x86-64""target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87""unsafe-fp-math"="false""use-soft-float"="false" } attributes #3 = { "correctly-rounded-divide-sqrt-fp-math"="false""disable-tail-calls"="false""frame-pointer"="none""less-precise-fpmad"="false""no-infs-fp-math"="false""no-nans-fp-math"="false""no-signed-zeros-fp-math"="false""no-trapping-math"="false""stack-protector-buffer-size"="8""target-cpu"="x86-64""target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87""unsafe-fp-math"="false""use-soft-float"="false" } attributes #4 = { nounwind } !llvm.module.flags = !{!0} !llvm.ident = !{!1} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 62e228f8fdb0ca86fc1663ef058f875021ede9a0)"} !2 = !{!3, !3, i64 0} !3 = !{!"any pointer", !4, i64 0} !4 = !{!"omnipotent char", !5, i64 0} !5 = !{!"Simple C++ TBAA"} !6 = !{!7, !7, i64 0} !7 = !{!"short", !4, i64 0} !8 = !{!9, !9, i64 0} !9 = !{!"int", !4, i64 0}
llvm source #2
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
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define dso_local void @_Z4testPiS_Ps(i32* %0, i32* %1, i16* %2) #0 { %4 = alloca i32*, align 8 %5 = alloca i32*, align 8 %6 = alloca i16*, align 8 %7 = alloca i32, align 4 store i32* %0, i32** %4, align 8 store i32* %1, i32** %5, align 8 store i16* %2, i16** %6, align 8 %8 = bitcast i32* %7 to i8* call void @llvm.lifetime.start.p0i8(i64 4, i8* %8) #4 %9 = load i16*, i16** %6, align 8 %10 = load i16, i16* %9, align 2 %11 = sext i16 %10 to i32 store i32 %11, i32* %7, align 4 %12 = load i32*, i32** %5, align 8 store i32 0, i32* %12, align 4 %13 = load i32, i32* %7, align 4 %14 = trunc i32 %13 to i16 %15 = load i16*, i16** %6, align 8 store i16 %14, i16* %15, align 2 %16 = bitcast i32* %7 to i8* call void @llvm.lifetime.end.p0i8(i64 4, i8* %16) #4 ret void } declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1 define dso_local i32 @main() #2 { %1 = alloca i32, align 4 %2 = alloca i32, align 4 store i32 0, i32* %1, align 4 %3 = bitcast i32* %2 to i8* call void @llvm.lifetime.start.p0i8(i64 4, i8* %3) #4 store i32 1, i32* %2, align 4 %4 = bitcast i32* %2 to i16* call void @_Z4testPiS_Ps(i32* %2, i32* %2, i16* %4) %5 = load i32, i32* %2, align 4 %6 = bitcast i32* %2 to i8* %7 = bitcast i32* %2 to i8* call void @llvm.lifetime.end.p0i8(i64 4, i8* %7) #4 ret i32 0 } declare dso_local i32 @printf(i8*, ...) #3 attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false""disable-tail-calls"="false""frame-pointer"="none""less-precise-fpmad"="false""min-legal-vector-width"="0""no-infs-fp-math"="false""no-jump-tables"="false""no-nans-fp-math"="false""no-signed-zeros-fp-math"="false""no-trapping-math"="false""stack-protector-buffer-size"="8""target-cpu"="x86-64""target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87""unsafe-fp-math"="false""use-soft-float"="false" } attributes #1 = { argmemonly nounwind willreturn } attributes #2 = { norecurse uwtable "correctly-rounded-divide-sqrt-fp-math"="false""disable-tail-calls"="false""frame-pointer"="none""less-precise-fpmad"="false""min-legal-vector-width"="0""no-infs-fp-math"="false""no-jump-tables"="false""no-nans-fp-math"="false""no-signed-zeros-fp-math"="false""no-trapping-math"="false""stack-protector-buffer-size"="8""target-cpu"="x86-64""target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87""unsafe-fp-math"="false""use-soft-float"="false" } attributes #3 = { "correctly-rounded-divide-sqrt-fp-math"="false""disable-tail-calls"="false""frame-pointer"="none""less-precise-fpmad"="false""no-infs-fp-math"="false""no-nans-fp-math"="false""no-signed-zeros-fp-math"="false""no-trapping-math"="false""stack-protector-buffer-size"="8""target-cpu"="x86-64""target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87""unsafe-fp-math"="false""use-soft-float"="false" } attributes #4 = { nounwind } !llvm.module.flags = !{!0} !llvm.ident = !{!1} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 62e228f8fdb0ca86fc1663ef058f875021ede9a0)"} !2 = !{!3, !3, i64 0} !3 = !{!"any pointer", !4, i64 0} !4 = !{!"omnipotent char", !5, i64 0} !5 = !{!"Simple C++ TBAA"} !6 = !{!7, !7, i64 0} !7 = !{!"short", !4, i64 0} !8 = !{!9, !9, i64 0} !9 = !{!"int", !4, i64 0}
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
CE on Bluesky
About the author
Statistics
Changelog
Version tree