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
@n = dso_local global i32 0, align 4 @C = dso_local global i32 0, align 4 ; Function Attrs: nounwind define dso_local void @_Z6test01v() addrspace(1) #0 { entry: %j = alloca i32, align 4 %i = alloca i32, align 4 br label %do.body do.body: ; preds = %do.cond, %entry %0 = load i32, i32* @C, align 4, !tbaa !2 %inc = add nsw i32 %0, 1 %1 = bitcast i32* %j to i8* call addrspace(1) void @llvm.lifetime.start.p0i8(i64 4, i8* %1) #2 store i32 0, i32* %j, align 4, !tbaa !2 br label %for.cond for.cond: ; preds = %for.inc6, %do.body %2 = load i32, i32* %j, align 4, !tbaa !2 %cmp = icmp slt i32 %2, 3 br i1 %cmp, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.cond %3 = bitcast i32* %j to i8* call addrspace(1) void @llvm.lifetime.end.p0i8(i64 4, i8* %3) #2 br label %for.end8 for.body: ; preds = %for.cond store i32 undef, i32* %i, align 4 %4 = bitcast i32* %i to i8* call addrspace(1) void @llvm.lifetime.start.p0i8(i64 4, i8* %4) #2 store i32 0, i32* %i, align 4, !tbaa !2 br label %for.cond1 for.cond1: ; preds = %for.inc, %for.body %5 = load i32, i32* %i, align 4, !tbaa !2 %6 = load i32, i32* @n, align 4, !tbaa !2 %cmp2 = icmp slt i32 %5, %6 br i1 %cmp2, label %for.body4, label %for.cond.cleanup3 for.cond.cleanup3: ; preds = %for.cond1 %7 = bitcast i32* %i to i8* call addrspace(1) void @llvm.lifetime.end.p0i8(i64 4, i8* %7) #2 br label %for.end for.body4: ; preds = %for.cond1 %8 = load i32, i32* %i, align 4, !tbaa !2 store volatile i32 %8, i32* @C, align 4, !tbaa !2 br label %for.inc for.inc: ; preds = %for.body4 %9 = load i32, i32* %i, align 4, !tbaa !2 %inc5 = add nsw i32 %9, 1 store i32 %inc5, i32* %i, align 4, !tbaa !2 br label %for.cond1, !llvm.loop !6 for.end: ; preds = %for.cond.cleanup3 br label %for.inc6 for.inc6: ; preds = %for.end %10 = load i32, i32* %j, align 4, !tbaa !2 %inc7 = add nsw i32 %10, 1 store i32 %inc7, i32* %j, align 4, !tbaa !2 br label %for.cond, !llvm.loop !8 for.end8: ; preds = %for.cond.cleanup br label %do.cond do.cond: ; preds = %for.end8 br i1 true, label %do.body, label %do.end, !llvm.loop !10 do.end: ; preds = %do.cond ret void } ; Function Attrs: argmemonly nofree nosync nounwind willreturn declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) addrspace(1) #1 ; Function Attrs: argmemonly nofree nosync nounwind willreturn declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) addrspace(1) #1 attributes #0 = { nounwind "disable-tail-calls"="false" "frame-pointer"="all" "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"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { argmemonly nofree nosync nounwind willreturn } attributes #2 = { nounwind } !llvm.module.flags = !{!0} !llvm.ident = !{!1} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{!"clang)"} !2 = !{!3, !3, i64 0, i64 4} !3 = !{!4, i64 4, !"int"} !4 = !{!5, i64 1, !"omnipotent char"} !5 = !{!"Simple C++ TBAA"} !6 = distinct !{!6, !7} !7 = !{!"llvm.loop.mustprogress"} !8 = distinct !{!8, !7, !9} !9 = !{!"llvm.loop.unroll.disable"} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.unroll.count", i32 2}
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