
Llvm
- 634 installs
- 155 repo stars
- Updated June 27, 2026
- mohitmishra786/low-level-dev-skills
LLVM is an Agent Skill that generates, analyzes, and optimizes LLVM IR for developers who build performance-critical compilers, backends, or low-level agent runtimes inside coding agents.
About
LLVM is an Agent Skill from mohitmishra786/low-level-dev-skills focused on LLVM intermediate representation for systems and compiler engineers. The skill helps coding agents produce, inspect, and tune LLVM IR when implementing language backends, JIT pipelines, or low-level runtimes where hand-written assembly is too brittle. Developers reach for LLVM when optimizing hot paths, lowering custom DSLs, or debugging IR-level performance regressions in performance-critical infrastructure. Catalog metadata lists 1 install and rank 3440 on skills.sh, reflecting a niche but specialized low-level development capability rather than general application coding.
- Generates and transforms LLVM Intermediate Representation
- Performs static analysis and optimization passes on LLVM bitcode
- Supports compilation targeting multiple CPU architectures
- Integrates with Clang and other LLVM toolchain components
- Enables custom compiler and language runtime development
Llvm by the numbers
- 634 all-time installs (skills.sh)
- +28 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #590 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/mohitmishra786/low-level-dev-skills --skill llvmAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 634 |
|---|---|
| repo stars | ★ 155 |
| Last updated | June 27, 2026 |
| Repository | mohitmishra786/low-level-dev-skills ↗ |
How do you generate and optimize LLVM IR for compilers?
Generate, analyze, and optimize LLVM IR code when building performance-critical backends, compilers, or low-level agent runtimes.
Who is it for?
Systems and compiler engineers working on LLVM-based backends, JIT compilers, or performance-critical low-level runtimes who need IR-level agent assistance.
Skip if: Web application developers who only need high-level framework code without compiler IR or systems-level optimization work.
When should I use this skill?
The user asks to write, analyze, optimize, or debug LLVM IR for compilers, backends, or low-level performance-critical runtimes.
What you get
LLVM IR snippets, optimization passes, and analysis notes for compiler backends or low-level runtimes.
- LLVM IR modules
- Optimization pass guidance
- IR analysis output
By the numbers
- Lists 1 install on skills.sh catalog metadata
- Ranked 3440 in the mohitmishra786/low-level-dev-skills collection
Files
LLVM IR and Tooling
Purpose
Guide agents through the LLVM IR pipeline: generating IR, running optimisation passes with opt, lowering to assembly with llc, and inspecting IR for debugging or performance work.
Triggers
- "Show me the LLVM IR for this function"
- "How do I run an LLVM optimisation pass?"
- "What does this LLVM IR instruction mean?"
- "How do I write a custom LLVM pass?"
- "Why isn't auto-vectorisation happening in LLVM?"
Workflow
1. Generate LLVM IR
# Emit textual IR (.ll)
clang -O0 -emit-llvm -S src.c -o src.ll
# Emit bitcode (.bc)
clang -O2 -emit-llvm -c src.c -o src.bc
# Disassemble bitcode to text
llvm-dis src.bc -o src.ll2. Run optimisation passes with opt
# Apply a specific pass
opt -passes='mem2reg,instcombine,simplifycfg' src.ll -S -o out.ll
# Standard optimisation pipelines
opt -passes='default<O2>' src.ll -S -o out.ll
opt -passes='default<O3>' src.ll -S -o out.ll
# List available passes
opt --print-passes 2>&1 | less
# Print IR before and after a pass
opt -passes='instcombine' --print-before=instcombine --print-after=instcombine src.ll -S -o out.ll 2>&1 | less3. Lower IR to assembly with llc
# Compile IR to object file
llc -filetype=obj src.ll -o src.o
# Compile to assembly
llc -filetype=asm -masm-syntax=intel src.ll -o src.s
# Target a specific CPU
llc -mcpu=skylake -mattr=+avx2 src.ll -o src.s
# Show available targets
llc --version4. Inspect IR
Key IR constructs to understand:
| Construct | Meaning |
|---|---|
alloca | Stack allocation (pre-SSA; mem2reg promotes to registers) |
load/store | Memory access |
getelementptr (GEP) | Pointer arithmetic / field access |
phi | SSA φ-node: merges values from predecessor blocks |
call/invoke | Function call (invoke has exception edges) |
icmp/fcmp | Integer/float comparison |
br | Branch (conditional or unconditional) |
ret | Return |
bitcast | Reinterpret bits (no-op in codegen) |
ptrtoint/inttoptr | Pointer↔integer (avoid where possible) |
5. Key passes
| Pass | Effect |
|---|---|
mem2reg | Promote alloca to SSA registers |
instcombine | Instruction combining / peephole |
simplifycfg | CFG cleanup, dead block removal |
loop-vectorize | Auto-vectorisation |
slp-vectorize | Superword-level parallelism (straight-line vectorisation) |
inline | Function inlining |
gvn | Global value numbering (common subexpression elimination) |
licm | Loop-invariant code motion |
loop-unroll | Loop unrolling |
argpromotion | Promote pointer args to values |
sroa | Scalar Replacement of Aggregates |
6. Debugging missed optimisations
# Why was a loop not vectorised?
clang -O2 -Rpass-missed=loop-vectorize -Rpass-analysis=loop-vectorize src.c
# Dump pass pipeline
clang -O2 -mllvm -debug-pass=Structure src.c -o /dev/null 2>&1 | less
# Print IR after each pass (very verbose)
opt -passes='default<O2>' -print-after-all src.ll -S 2>&1 | less7. Useful llvm tools
| Tool | Purpose |
|---|---|
llvm-dis | Bitcode → textual IR |
llvm-as | Textual IR → bitcode |
llvm-link | Link multiple bitcode files |
llvm-lto | Standalone LTO |
llvm-nm | Symbols in bitcode/object |
llvm-objdump | Disassemble objects |
llvm-profdata | Merge/show PGO profiles |
llvm-cov | Coverage reporting |
llvm-mca | Machine code analyser (throughput/latency) |
For binutils equivalents, see skills/binaries/binutils.
Related skills
- Use
skills/compilers/clangfor source-level Clang flags - Use
skills/binaries/linkers-ltofor LTO at link time - Use
skills/profilers/linux-perfcombined withllvm-mcafor micro-architectural analysis
LLVM IR Reference
Source: <https://llvm.org/docs/LangRef.html>
Table of Contents
1. Types 2. Instructions 3. Attributes and metadata 4. Opt pass names
---
Types
| Type | Description |
|---|---|
i1 | 1-bit integer (boolean) |
i8, i16, i32, i64 | Integer of N bits |
float | 32-bit IEEE 754 |
double | 64-bit IEEE 754 |
ptr | Opaque pointer (LLVM 15+) |
[N x T] | Array of N elements of type T |
{T1, T2, ...} | Struct (packed: <{...}>) |
<N x T> | Vector of N elements |
void | No value |
---
Instructions
Memory
%ptr = alloca i32, align 4 ; stack allocation
%val = load i32, ptr %ptr, align 4 ; load
store i32 42, ptr %ptr, align 4 ; store
%p2 = getelementptr i32, ptr %ptr, i64 1 ; pointer arithmeticArithmetic
%sum = add i32 %a, %b
%diff = sub i32 %a, %b
%prod = mul i32 %a, %b
%quot = sdiv i32 %a, %b ; signed divide
%quot = udiv i32 %a, %b ; unsigned divide
%rem = srem i32 %a, %b ; signed remainder
%shl = shl i32 %a, 3 ; shift left
%lsr = lshr i32 %a, 3 ; logical shift right
%asr = ashr i32 %a, 3 ; arithmetic shift right
%and = and i32 %a, %b
%or = or i32 %a, %b
%xor = xor i32 %a, %bComparison
%c = icmp eq i32 %a, %b ; integer compare: eq ne slt sle sgt sge ult ule ugt uge
%c = fcmp oeq float %a, %b ; float compare: oeq one olt ole ogt oge ord unoControl flow
br label %next ; unconditional branch
br i1 %cond, label %true, label %false ; conditional branch
ret i32 %val
ret void
%ret = call i32 @foo(i32 %a, i32 %b)
switch i32 %val, label %default [ i32 0, label %case0
i32 1, label %case1 ]PHI nodes (SSA merging)
%result = phi i32 [ %val_from_block_a, %block_a ],
[ %val_from_block_b, %block_b ]Type conversion
%i = trunc i64 %x to i32 ; truncate
%x = zext i32 %i to i64 ; zero-extend
%x = sext i32 %i to i64 ; sign-extend
%p = inttoptr i64 %addr to ptr ; integer to pointer
%n = ptrtoint ptr %p to i64 ; pointer to integer
%f = sitofp i32 %i to float ; signed int to float
%i = fptosi float %f to i32 ; float to signed int
%d = fpext float %f to double ; float extend
%f = fptrunc double %d to float ; float truncate---
Attributes and metadata
; Function attributes
define i32 @foo(i32 %x) noinline nounwind readonly {
; Parameter attributes
define void @bar(i32 noundef %x, ptr nocapture nonnull %p) {
; Inline hint
define i32 @hot() alwaysinline {
; Alignment
%val = load i32, ptr %ptr, align 16Common function attributes:
noinline— never inlinealwaysinline— always inlinenoreturn— never returns (likeabort)nounwind— never throws an exceptionreadonly— only reads memoryreadnone— does not access memory
---
Opt pass names (LLVM 14+ new pass manager)
| Pass name | Effect |
|---|---|
mem2reg | Promote alloca to SSA |
instcombine | Instruction combining |
simplifycfg | CFG simplification |
gvn | Global value numbering |
licm | Loop-invariant code motion |
loop-vectorize | Auto-vectorisation |
slp-vectorize | SLP vectorisation |
inline | Function inlining |
early-cse | Early common subexpression elimination |
dce | Dead code elimination |
sroa | Scalar Replacement of Aggregates |
loop-unroll | Loop unrolling |
tailcallelim | Tail call elimination |
reassociate | Reassociation for better constant folding |
Pipeline example:
opt -passes='mem2reg,instcombine,simplifycfg,gvn,licm' input.ll -S -o out.llRelated skills
How it compares
Pick the LLVM skill for IR-level compiler and runtime work instead of general refactoring or language-framework skills aimed at application layers.
FAQ
What problems does the LLVM skill solve?
The LLVM skill helps developers generate, analyze, and optimize LLVM IR when building compilers, performance-critical backends, or low-level agent runtimes. It focuses on intermediate representation work rather than high-level application frameworks.
Who should use the LLVM Agent Skill?
The LLVM Agent Skill suits systems and compiler engineers implementing LLVM-based backends or JIT pipelines. Web-only developers without IR or systems programming needs should use higher-level language skills instead.