reduce-ssa-repro

Minimizes SSA files that trigger noir-ssa pipeline bugs into smallest reproduction cases.

1.4k|408|Updated Aug 4, 2020
One-click install
npx skills add https://github.com/noir-lang/noir --skill reduce-ssa-repro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: reduce-ssa-repro
Source: https://github.com/noir-lang/noir/tree/main/.claude/skills/reduce-ssa-repro
Command: npx skills add https://github.com/noir-lang/noir --skill reduce-ssa-repro

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

When a bug is found in the Noir SSA compiler pipeline, the triggering SSA file is often large and hard to diagnose. This Skill systematically shrinks that file to the smallest possible input that still reproduces the crash, making the root cause visible.

Core Features & Use Cases

  • Pass pipeline minimization: Removes unnecessary SSA passes and bakes valid passes into the input to shrink both the pipeline and the file.
  • Automated reduction scripts: Python scripts remove unused instructions and collapse conditional branches (jmpif to jmp) while verifying the crash still reproduces after every change.
  • Crash validation harness: A shell script validates that the input parses, the detection pass alone succeeds, and the full pipeline crashes with the expected error pattern.
  • Use Case: After bisecting identifies that the Unrolling pass corrupts SSA detected by Inlining Brillig Calls, run the reducers to shrink a 500-line SSA file down to a 20-line case revealing an unmapped value reference.

Quick Start

Minimize the SSA file input.ssa that crashes the noir-ssa pipeline with the Unrolling pass using the reduce-ssa-repro skill.

Frequently Asked Questions about reduce-ssa-repro

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I minimize an SSA file that crashes the Noir compiler?

Build the noir-ssa CLI in debug mode, then run reduce_instructions.py and reduce_branches.py with the crashing passes and error pattern. The scripts iteratively remove instructions and collapse jmpif branches while verifying the crash still reproduces.

How to reproduce a noir-ssa pipeline crash for debugging?

Use the reproduce_crash.sh script with SSA_PASSES set to the corruption passes and DETECTION_PASS set to the detecting pass. It validates the input parses, confirms the detection pass alone succeeds, and then runs the full crashing pipeline.

Why must noir-ssa be built in debug mode for SSA reduction?

Many SSA invariant checks are guarded by debug_assertions and compiled out of release builds. Using target/debug/noir-ssa ensures panics like unmapped value errors are actually triggered during reduction.

What bug patterns does SSA reduction typically reveal?

Common patterns include unreachable value references caught by normalize_value_ids panicking with unmapped value, missing stores causing load-before-store errors, and passes that change program semantics detectable by comparing interpreter results.

When should SSA reduction be run in the debugging workflow?

Run it after bisecting has identified which SSA passes trigger the bug. Reduction requires the input SSA file, the corruption and detection passes, and the stderr error pattern as inputs.