Skip to contentSkip to content
Verified credentials. On-chain. Forever.Learn more
Cover image for Add Constant Folding and Dead Code Elimination to a Toy Compiler
Code

Add Constant Folding and Dead Code Elimination to a Toy Compiler

FreeVerified credential2 weeksIntermediate

Overview

What this challenge is about.

Fork the repo, read the IR specification (3-address code, register-based, documented in /docs/ir.md). Implement constant folding as an IR-to-IR pass: any operation on literal operands collapses to a single literal. Implement dead code elimination using a worklist algorithm that marks instructions whose results are unused and removes them safely (respecting side effects). Add a --optimize CLI flag that runs both passes. Provide a 10-program benchmark suite (provided) and report instruction-count reductions per program in a short Markdown report.

CredentialBlockchain-anchored
ShareableLinkedIn-ready
LanguageEnglish
PaceSelf-paced

The Brief

What you'll do, and what you'll demonstrate.

Implement constant folding and dead code elimination passes on a real toy compiler's IR and prove the speedup on a benchmark suite.

Earning criteria — what you'll demonstrate

  • Read and modify a real compiler's IR data structures
  • Implement constant folding respecting overflow and type semantics
  • Implement DCE using a worklist algorithm
  • Measure optimization impact with reproducible benchmarks

Program Fit

Where this fits in your program.

Sharpens the same skills your degree expects you to demonstrate.

Skills

Skills you'll demonstrate.

Each one shows up on your verified credential.

Careers

Roles this prepares you for.

Real titles. Real skill bridges. Pick the one closest to your trajectory.

Career mappings coming soon.

One more thing

You can put a credential on your CV by Friday.