agentleFS
rainoftimerainoftime/pl-skills/inline-expander/SKILL.md

inline-expander

Skill17 starsChanged 9 months agoApache-2.0View on GitHub

Implement function inlining to eliminate call overhead and enable further optimizations.

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
  1. Distinctive:

    Consider profile-guided optimization for hot call sites

    line 45
  2. Distinctive:

    Run dead code elimination after inlining

    line 46

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Call Site Inlining: Replace call with callee body
  2. Parameter Substitution: Replace formal parameters with actual arguments
  3. Return Handling: Replace returns with assignments or gotos
  4. Heuristic Deciding: Choose which functions to inline
  5. Recursive Inlining: Handle self-recursive functions

Key Concepts

ConceptDescription
Call SiteLocation where a function is called
CalleeThe function being called
CallerThe function making the call
Inlining HeuristicsRules for deciding what to inline
Code BloatExcessive 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 inlining
  • constant-propagation-pass - Enabled by inlining
  • loop-optimizer - Combined for maximum effect
  • ssa-constructor - Simplifies inlining

Canonical References

ReferenceWhy It Matters
Aycock, "A Brief History of Just-in-Time Compilation" (2010)Context for inlining importance
LLVM Inline Cost AnalysisProduction heuristics
GCC Inlining ParametersTuning guidelines

Tradeoffs and Limitations

Approach Tradeoffs

ApproachProsCons
Always inlineFast, predictableCode bloat
Size-basedControls bloatMay miss opportunities
Profile-guidedOptimal decisionsRequires 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:

CriterionWhat to Look For
CorrectnessPreserves program semantics
HeuristicsGood tradeoff between speed and size
HandlingDeals with returns, recursion
IntegrationWorks 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:

ToolWhy It Matters
LLVM InlinerProduction inliner with cost model
GCC InlinerGCC's inlining passes
JVM JITHotSpot method inlining
V8JavaScript inline caching

Key Systems

  • LLVM: State-of-the-art inlining
  • Graal: Truffle-based inlining

Research Frontiers

Current inlining research:

DirectionKey PapersChallenge
Cost model"Inline Cost Analysis"Accuracy
PGO"Profile-guided Inlining"Feedback
Specialization"Specialization for Inlining"Dynamic

Hot Topics

  1. Machine learning inlining: Learning inlining decisions
  2. WASM inlining: WebAssembly optimization

Implementation Pitfalls

Common inlining bugs:

PitfallReal ExamplePrevention
Code bloatToo much inliningCost model
Compile timeInlining slows compileLimits
RecursiveInfinite recursionCycle detection

Download now (ZIP)

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.