← Back to Pull requests

perf(cir-to-std): make block argument conversion linear in the number of blocks #1973

Closed
unknown closed this pull request without merging on Nov 03, 2026 03:40 UTC
View on GitHub
unknown unknown commented on Nov 03, 2026 02:58 UTC
Author

This makes cir-to-std linear in the number of blocks. It was quadratic for the same reason as the first commit of #1879: in convertCirBlock, each createOp! fell back to return ctx when it failed, so ctx was still alive when createOp! modified it, and the whole context was copied once per cast. The fallbacks now throw instead, as convertBlockArgument in isel-br-riscv64 does, so convertCirBlock returns Except String. With an insertion point, createOp! returns none only after it panics, so valid IR does not reach the new errors.

veir-opt -p=cir-to-std --disable-verifiers on one cir.func of N blocks, each ending in a cir.br to the next, single core:

N        before    after
4000     0.46 s    0.18 s
8000     1.28 s    0.34 s
16000    4.63 s    0.66 s
32000    17.5 s    1.33 s

Parsing and printing the 32000-block input alone takes 0.69 s. The output is the same before and after.

I've been profiling veir with Claude; this is from the same work as #1879.

Diff: 125 lines (+93 / -32) across 1 files Reviewer: math-fehr Review duration: 42m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.37) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 125 lines diff across 1 files
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
56%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.289
Shallow Review Depth shallow_review_depth
0.289
Ai Authored ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #1973"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 56.8% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 36.9% (MEDIUM) · Higher = larger blast radius
36.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 56.8% · Lower = rushed or shallow review
56.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 16.0% · Safe to merge
16.0%
Repository