/llvm-ir-and-passes
LLVM IR and passes skill for reading compiler IR. Use when analyzing LLVM IR, understanding SSA, pass pipeline order, or running opt on bitcode. Activates on queries about LLVM IR, SSA form, opt passes, llvm-dis, pass pipeline, or reading .ll files.
$ npx -y skills add mohitmishra786/low-level-dev-skills --skill llvm-ir-and-passes --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/llvm-ir-and-passes
Context preview
The summary Claude sees to decide when to auto-load this skill.
LLVM IR and passes skill for reading compiler IR. Use when analyzing LLVM IR, understanding SSA, pass pipeline order, or running opt on bitcode. Activates on queries about LLVM IR, SSA form, opt passes, llvm-dis, pass pipeline, or reading .ll files.
SKILL.md
llvm-ir-and-passes.SKILL.mdname: llvm-ir-and-passes
description: LLVM IR and passes skill for reading compiler IR. Use when analyzing LLVM IR, understanding SSA, pass pipeline order, or running opt on bitcode. Activates on queries about LLVM IR, SSA form, opt passes, llvm-dis, pass pipeline, or reading .ll files.
LLVM IR and Passes
Purpose
Teach agents to read and reason about LLVM IR (SSA, types, terminators), navigate the standard pass pipeline, and use `opt`/`llvm-dis` for inspection. Complements `skills/compilers/llvm` (toolchain) and `skills/compiler-internals/llvm-passes` (writing plugins) — not merged.
When to Use
- Understanding what `-O2` changed in generated IR
- Triaging miscompiles between Clang versions
- Preparing to write a custom pass
- Teaching SSA and dominance without writing C++ passes yet
Workflow
1. LLVM IR structure
; Function in SSA form
define i32 @add(i32 %a, i32 %b) {
entry:
%sum = add i32 %a, %b
ret i32 %sum
}Key concepts: basic blocks, PHI nodes at merges, typed values (`i32`, `ptr`, vectors).
2. Emit IR from Clang
clang -S -emit-llvm -O0 -o foo.ll foo.c
clang -c -emit-llvm -O2 -o foo.bc foo.c
llvm-dis foo.bc -o foo.ll
3. Standard optimization pipeline (New PM)
Clang `-O2` roughly runs:
SimplifyCFG → InstCombine → GVN → LICM → LoopVectorize → ...
Inspect with:
opt -passes='default<O2>' -S foo.ll -o foo-opt.ll
opt -passes='default<O2>' -print-passes foo.ll 2>&1 | head
4. Useful analysis passes
| Pass | Shows | |------|-------| | `-passes=print<domtree>` | Dominator tree | | `-passes=print<loops>` | Loop nests | | `-passes=print-alias-sets` | Alias sets |
opt -passes='print<domtree>' -disable-output foo.ll
5. Reading PHI and UB
merge:
%v = phi i32 [ %a, %then ], [ %b, %else ]
`undef` and `poison` in IR model LLVM poison semantics — distinct from C UB but related.
6. Compare before/after
opt -passes='instcombine,simplifycfg' -S foo.ll -o - | diff -u foo.ll -
7. Agent usage
/llvm-ir-and-passes Explain this PHI node and which pass likely created it
Common Problems
| Symptom | Cause | Fix | |---------|-------|-----| | Pass not found | LLVM version rename | `opt --print-passes` for your build | | IR mismatch | Different LLVM major | Match clang/opt versions | | "optnone" blocks opts | `-O0` attribute | Compile with `-O1+` | | Huge IR | Inlined headers | `-fno-discard-value-names` off; filter function | | Wrong pipeline | Legacy vs NPM | Use `-passes=` syntax |
Related Skills
- `skills/compilers/llvm` — toolchain overview
- `skills/compiler-internals/llvm-passes` — writing PassPlugins
- `skills/compiler-internals/compiler-optimizations-deep` — RA and ISel
- `skills/compiler-internals/compiler-frontend` — IR generation
- `skills/rust/rustc-basics` — `rustc --emit=llvm-ir`
Read more
name: llvm-ir-and-passes description: LLVM IR and passes skill for reading compiler IR. Use when analyzing LLVM IR, understanding SSA, pass pipeline order, or running opt on bitcode. Activates on queries about LLVM IR, SSA form, opt passes, llvm-dis, pass pipeline, or reading .ll files.
LLVM IR and Passes
Purpose
Teach agents to read and reason about LLVM IR (SSA, types, terminators), navigate the standard pass pipeline, and use `opt`/`llvm-dis` for inspection. Complements `skills/compilers/llvm` (toolchain) and `skills/compiler-internals/llvm-passes` (writing plugins) — not merged.
When to Use
- Understanding what `-O2` changed in generated IR
- Triaging miscompiles between Clang versions
- Preparing to write a custom pass
- Teaching SSA and dominance without writing C++ passes yet
Workflow
1. LLVM IR structure
; Function in SSA form
define i32 @add(i32 %a, i32 %b) {
entry:
%sum = add i32 %a, %b
ret i32 %sum
}Key concepts: basic blocks, PHI nodes at merges, typed values (`i32`, `ptr`, vectors).
2. Emit IR from Clang
clang -S -emit-llvm -O0 -o foo.ll foo.c clang -c -emit-llvm -O2 -o foo.bc foo.c llvm-dis foo.bc -o foo.ll
3. Standard optimization pipeline (New PM)
Clang `-O2` roughly runs:
SimplifyCFG → InstCombine → GVN → LICM → LoopVectorize → ...
Inspect with:
opt -passes='default<O2>' -S foo.ll -o foo-opt.ll opt -passes='default<O2>' -print-passes foo.ll 2>&1 | head
4. Useful analysis passes
| Pass | Shows | |------|-------| | `-passes=print<domtree>` | Dominator tree | | `-passes=print<loops>` | Loop nests | | `-passes=print-alias-sets` | Alias sets |
opt -passes='print<domtree>' -disable-output foo.ll
5. Reading PHI and UB
merge: %v = phi i32 [ %a, %then ], [ %b, %else ]
`undef` and `poison` in IR model LLVM poison semantics — distinct from C UB but related.
6. Compare before/after
opt -passes='instcombine,simplifycfg' -S foo.ll -o - | diff -u foo.ll -
7. Agent usage
/llvm-ir-and-passes Explain this PHI node and which pass likely created it
Common Problems
| Symptom | Cause | Fix | |---------|-------|-----| | Pass not found | LLVM version rename | `opt --print-passes` for your build | | IR mismatch | Different LLVM major | Match clang/opt versions | | "optnone" blocks opts | `-O0` attribute | Compile with `-O1+` | | Huge IR | Inlined headers | `-fno-discard-value-names` off; filter function | | Wrong pipeline | Legacy vs NPM | Use `-passes=` syntax |
Related Skills
- `skills/compilers/llvm` — toolchain overview
- `skills/compiler-internals/llvm-passes` — writing PassPlugins
- `skills/compiler-internals/compiler-optimizations-deep` — RA and ISel
- `skills/compiler-internals/compiler-frontend` — IR generation
- `skills/rust/rustc-basics` — `rustc --emit=llvm-ir`
A curated suite of AI agent skills for systems and low-level programming — C/C++, Rust, Zig, GPU, bare-metal firmware, Linux kernel/driver development, computer architecture, compiler internals, HPC, and more.
Repo: mohitmishra786/low-level-dev-skills
Other skills on low-level-dev-skills.
- /custom-allocators
Custom allocator skill for memory allocation strategies. Use when implementing pool/slab/arena allocators, tuning jemalloc/mimalloc, writing Rust GlobalAlloc, or benchmarking allocator performance. Activates on queries about jemalloc, mimalloc, tcmalloc, arena allocator,
Open skill - /numa-programming
NUMA programming skill for multi-socket memory locality. Use when detecting NUMA topology, binding processes with numactl, using libnuma API, building NUMA-aware data structures, or measuring remote access penalties. Activates on queries about numactl, libnuma, NUMA topology,
Open skill - /af-xdp
AF_XDP skill for high-performance XDP sockets. Use when creating AF_XDP sockets, configuring UMEM and XSK rings, XDP_REDIRECT programs, copy vs zero-copy mode, or comparing with DPDK. Activates on queries about AF_XDP, xsk_umem, XDP_REDIRECT, libbpf xsk, or zero-copy XDP.
Open skill - /dpdk
DPDK skill for userspace packet I/O. Use when initializing EAL, configuring PMD drivers, using mbuf pools and rte_ring, setting up huge pages, RSS, or testpmd validation. Activates on queries about DPDK, EAL, rte_eth_rx_burst, hugepages, PMD, or testpmd.
Open skill - /io-uring
io_uring skill for Linux async I/O. Use when building high-performance servers with liburing, multi-shot operations, provided buffers, fixed files, zero-copy send, or tokio-uring. Activates on queries about io_uring, SQE/CQE, liburing, IORING_OP_PROVIDE_BUFFERS, or io_uring vs
Open skill - /adc-dac-baremetal
Bare-metal ADC and DAC skill. Use when configuring analog sampling, DMA-driven ADC, calibration, or DAC output on MCUs. Activates on queries about ADC bare-metal, sampling time, DMA ADC, or DAC channel setup.
Open skill

