inline-expander
Skill17 starsChanged 9 months agoApache-2.0View on GitHub
Implement function inlining to eliminate call overhead and enable further optimizations.
In this repository98 other files it gives its agents.
- abstract-interpretation-engineSkill
- abstract-machineSkill
- acsl-annotation-assistantSkill
- actor-model-implementerSkill
- algebraic-effectsSkill
- alias-and-points-to-analysisSkill
- axiomatic-semanticsSkill
- bidirectional-type-checkingSkill
- bisimulation-checkerSkill
- capability-systemSkill
- closure-converterSkill
- common-subexpression-eliminatorSkill
- concurrency-verifierSkill
- constant-propagation-passSkill
- contextual-equivalenceSkill
- control-flow-analysisSkill
- coq-proof-assistantSkill
- cps-transformerSkill
- dafny-verifierSkill
- dataflow-analysis-frameworkSkill
- dead-code-eliminatorSkill
- defunctionalizationSkill
- denotational-semantics-builderSkill
- dependent-type-implementerSkill
- dsl-embeddingSkill
- effect-handlers-implementerSkill
- effect-systemSkill
- effect-type-systemSkill
- escape-analysisSkill
- existential-typesSkill
- ffi-designerSkill
- fuzzer-generatorSkill
- gadt-implementerSkill
- garbage-collector-implementerSkill
- graalvm-truffle-implementerSkill
- gradual-typing-implementerSkill
- higher-order-abstract-syntaxSkill
- hoare-logic-verifierSkill
- incremental-computationSkill
- information-flow-analyzerSkill
- interprocedural-analysisSkill
- invariant-generatorSkill
- jit-compiler-builderSkill
- lambda-calculus-interpreterSkill
- language-server-protocolSkill
- lean-proverSkill
- lexer-generatorSkill
- linear-type-implementerSkill
- liveness-analysisSkill
- llvm-backend-generatorSkill
- lock-free-data-structureSkill
- loop-optimizerSkill
- loop-termination-proverSkill
- macro-expanderSkill
- memory-allocatorSkill
- message-passing-systemSkill
- mlir-dialect-designerSkill
- model-checkerSkill
- module-systemSkill
- monad-transformerSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 45
Consider profile-guided optimization for hot call sites
- Distinctive: line 46
Run dead code elimination after inlining
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Inline Expander
Function inlining replaces a function call with the body of the called function, eliminating call overhead and enabling further optimizations. It is one of the most important optimizations in compilers.
When to Use This Skill
- Building optimizing compilers
- Eliminating abstraction overhead
- Enabling interprocedural optimization
- Improving cache locality
- Reducing function call overhead
What This Skill Does
- Call Site Inlining: Replace call with callee body
- Parameter Substitution: Replace formal parameters with actual arguments
- Return Handling: Replace returns with assignments or gotos
- Heuristic Deciding: Choose which functions to inline
- Recursive Inlining: Handle self-recursive functions
Key Concepts
| Concept | Description |
| Call Site | Location where a function is called |
| Callee | The function being called |
| Caller | The function making the call |
| Inlining Heuristics | Rules for deciding what to inline |
| Code Bloat | Excessive size growth from inlining |
Tips
- Inline small, frequently-called functions first
- Be careful with recursive functions (limited unrolling)
- Consider profile-guided optimization for hot call sites
- Run dead code elimination after inlining
- Monitor code size growth
Common Use Cases
- Eliminating abstraction penalty (getters, small helpers)
- Enabling constant propagation across call boundaries
- Reducing indirect call overhead
- Template instantiation in C++
- Optimizing library functions
Related Skills
dead-code-eliminator- Clean up after inliningconstant-propagation-pass- Enabled by inliningloop-optimizer- Combined for maximum effectssa-constructor- Simplifies inlining
Canonical References
| Reference | Why It Matters |
| Aycock, "A Brief History of Just-in-Time Compilation" (2010) | Context for inlining importance |
| LLVM Inline Cost Analysis | Production heuristics |
| GCC Inlining Parameters | Tuning guidelines |
Tradeoffs and Limitations
Approach Tradeoffs
| Approach | Pros | Cons |
| Always inline | Fast, predictable | Code bloat |
| Size-based | Controls bloat | May miss opportunities |
| Profile-guided | Optimal decisions | Requires profiling |
When NOT to Use This Skill
- Large functions (causes code bloat)
- Functions called from many places
- Debug builds (need stack traces)
- Recursive functions (infinite growth)
Limitations
- Can cause significant code size increase
- May hurt instruction cache performance
- Complicates debugging
Assessment Criteria
A high-quality implementation should have:
| Criterion | What to Look For |
| Correctness | Preserves program semantics |
| Heuristics | Good tradeoff between speed and size |
| Handling | Deals with returns, recursion |
| Integration | Works with other optimizations |
Quality Indicators
✅ Good: Selective inlining, measurable speedup, controlled size growth ⚠️ Warning: Inlines too much or too little ❌ Bad: Breaks semantics, causes infinite recursion
Research Tools & Artifacts
Real-world inlining implementations:
| Tool | Why It Matters |
| LLVM Inliner | Production inliner with cost model |
| GCC Inliner | GCC's inlining passes |
| JVM JIT | HotSpot method inlining |
| V8 | JavaScript inline caching |
Key Systems
- LLVM: State-of-the-art inlining
- Graal: Truffle-based inlining
Research Frontiers
Current inlining research:
| Direction | Key Papers | Challenge |
| Cost model | "Inline Cost Analysis" | Accuracy |
| PGO | "Profile-guided Inlining" | Feedback |
| Specialization | "Specialization for Inlining" | Dynamic |
Hot Topics
- Machine learning inlining: Learning inlining decisions
- WASM inlining: WebAssembly optimization
Implementation Pitfalls
Common inlining bugs:
| Pitfall | Real Example | Prevention |
| Code bloat | Too much inlining | Cost model |
| Compile time | Inlining slows compile | Limits |
| Recursive | Infinite recursion | Cycle detection |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

