fixLCSSA: cache collapsed LCSSA values (exponential recursion in MITgcm) #3944
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.44) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.44 · 253 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.331
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #3944"
general
weight: 0.35
wsmoses
<!-- claude-projects-attribution: {"github_login":"vchuravy"} -->
_Requested by Valentin · project thread_
When the manual LCSSA phi that
fixLCSSAbuilds for(inst, forwardBlock)collapses to a single value, the cache entry forforwardBlockwas erased. Every later query for that block then walked all its predecessors again. Across a chain of if/else joins this is exponential in the number of joins.Where it shows up
MITgcm adjoint builds (Fortran, full-LTO Enzyme link).
createInvertedTerminator→branchToCorrespondingTargetunwraps a branch condition. The condition depends on a Fortran string-compare loop (preprocess_exf_wind_, lab_sea), and itsllvm.ucmpresult is looked up far below the loop. The query recursed 229 blocks deep. The links of lab_sea, global_ocean.cs32x15 and offline_exf_seaice ran 2.5 to 4.5 h infixLCSSAwithout finishing.Fix
forwardBlock: either it is not an instruction, or it dominates the block. Erase the entry only otherwise.lcssaFixesholdsWeakTrackingVH, so a cached value that is erased later reads back as null. Treat that as a cache miss instead of returning null. Without this, 1D_ocean_ice_column hit a nullisa<UndefValue>inlookupM.Testing
opt -passes='lto<O3>'repro finishes Enzyme in under 27 minutes. Before, it ran for more than 4.5 h without finishing.check-enzymeon LLVM 16: 1210 passed, 10 expectedly failed.🤖 Generated with Claude Code