dead-code-eliminator
Skill17 starsChanged 9 months agoApache-2.0View on GitHub
Eliminate unreachable and unused code to reduce program size and improve performance.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- SkillMedev/legacy-modernizationtheir own version, first seen Oct 5, 2026
- santosomar/general-secure-coding-agent-skillstheir own version, first seen Mar 10, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- SkillMedev/legacy-modernization★ 2same name
- santosomar/general-secure-coding-agent-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
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
- 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
- inline-expanderSkill
- 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
9 rules. About 0 are common, 9 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
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 25
Unreachable Code Elimination: Remove code that cannot be executed
- Distinctive: line 26
Dead Variable Elimination: Remove computations of unused values
- Distinctive: line 27
Dead Store Elimination: Remove writes that are never read
- Distinctive: line 28
Dead Function Elimination: Remove functions that are never called
- Distinctive: line 43
Run DCE after inlining to clean up unused parameters
- Distinctive: line 45
Use SSA form for simpler liveness analysis
- Distinctive: line 46
Run iteratively until fixpoint
- Distinctive: line 84
When code size is not a concern
- Distinctive: line 86
When side effects are unclear (volatile, I/O)
≈ “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
Dead Code Eliminator
Dead code elimination (DCE) removes code that has no effect on program output, including unreachable code, unused computations, and redundant assignments. It is a fundamental optimization in compilers.
When to Use This Skill
- Optimizing compiler passes
- Reducing binary size
- Improving cache utilization
- Cleaning up generated code
- Minifying code for distribution
What This Skill Does
- Unreachable Code Elimination: Remove code that cannot be executed
- Dead Variable Elimination: Remove computations of unused values
- Dead Store Elimination: Remove writes that are never read
- Dead Function Elimination: Remove functions that are never called
- Aggressive DCE: Iteratively remove dead code until fixpoint
Key Concepts
| Concept | Description |
| Dead Code | Code that has no effect on program output |
| Unreachable Code | Code that cannot be executed |
| Live Variable | Variable that may be used later |
| Critical Instruction | Instruction with side effects |
| Fixpoint | State where no more changes occur |
Tips
- Run DCE after inlining to clean up unused parameters
- Combine with constant propagation for better results
- Use SSA form for simpler liveness analysis
- Run iteratively until fixpoint
- Be careful with memory-mapped I/O (appears dead)
Common Use Cases
- Post-inlining cleanup
- Tree shaking in JavaScript bundlers
- Removing debug code in production
- Optimizing generated code
- Binary size reduction
Related Skills
constant-propagation-pass- Often combined with DCEinline-expander- Creates dead code opportunitiesdataflow-analysis-framework- Foundation for livenessssa-constructor- Simplifies analysis
Canonical References
| Reference | Why It Matters |
| Muchnick, "Advanced Compiler Design and Implementation", Ch. 18 (1997) | Comprehensive treatment |
| Click & Cooper, "Combining Analyses, Optimizing and Using Them" (1995) | Modern DCE approach |
| LLVM Dead Code Elimination Pass | Production implementation |
Tradeoffs and Limitations
Approach Tradeoffs
| Approach | Pros | Cons |
| Simple DCE | Fast, easy | Misses opportunities |
| Aggressive DCE | Removes more code | More complex |
| ADCE with interprocedural | Global optimization | Very expensive |
When NOT to Use This Skill
- When code size is not a concern
- For debug builds (keep code for debugging)
- When side effects are unclear (volatile, I/O)
Limitations
- May remove intentionally dead code (defensive programming)
- Cannot remove code that might have side effects
- Interprocedural DCE requires whole-program analysis
Assessment Criteria
A high-quality implementation should have:
| Criterion | What to Look For |
| Soundness | Never removes code that affects output |
| Completeness | Removes all provably dead code |
| Speed | Fast enough for production use |
| Iteration | Reaches fixpoint |
Quality Indicators
✅ Good: Removes all dead code, preserves semantics, fast ⚠️ Warning: Removes some but not all dead code ❌ Bad: Removes code that affects program output
Research Tools & Artifacts
Real-world DCE implementations:
| Tool | Why It Matters |
| LLVM DCE pass | Production DCE in LLVM |
| GCC DCE | GCC's dead code elimination |
| Soot DCE | Java bytecode DCE |
| GraalVM DCE | Truffle-based DCE |
Key Optimizations
- ADCE (Aggressive DCE): More aggressive than standard
- LICM with DCE: Loop-invariant code motion
Research Frontiers
Current DCE research:
| Direction | Key Papers | Challenge |
| Interprocedural DCE | "Whole-program DCE" | Cross-module analysis |
| Type-based DCE | "Type-driven DCE" | Type information |
| Dynamically dead | "Dynamic Dead Code" | Runtime dead code |
Hot Topics
- DCE for microservices: Removing unused endpoints
- Web bundle optimization: Tree-shaking in bundlers
Implementation Pitfalls
Common DCE bugs:
| Pitfall | Real Example | Prevention |
| Side effects | Removing print statements | Track I/O precisely |
| Volatile | Removing volatile reads | Handle volatile |
| Finalizers | Removing finalize() | Don't remove finalizers |
| Self-modifying | Removing JIT code | Handle dynamic code |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

