ARCH8.md (1345B)
1 # ARCH8: Inter-Procedural Performance Caches 2 3 ## Goal 4 5 Eliminate avoidable recomputation in inter-procedural analysis by 6 caching call-graph and function block ranges, reducing worklist 7 iteration cost on large inputs. 8 9 ## Scope 10 11 - Precompute call graph once per run. 12 - Precompute per-function block ranges/indices once per run. 13 - Keep analysis semantics unchanged. 14 15 ## Hotspots 16 17 - `runInterProc` rebuilds call graph and rescans functions each 18 iteration. 19 - `functionBlocks` linearly scans blocks every call. 20 21 ## Architecture 22 23 ### Call Graph Cache 24 25 - Build `callGraph :: Map Text [Text]` once. 26 - Build `callerMap :: Map Text [Text]` once by inverting the call graph. 27 - Inter-proc loop uses `callerMap` for worklist expansion. 28 29 ### Function Block Cache 30 31 - Build `funcBlocks :: Map Text [Int]` once using a single pass through 32 block labels. 33 - Optionally store `(startIdx, endIdx)` to avoid per-block membership 34 sets where possible. 35 36 ## Integration 37 38 - Add helper(s) in `CFG` or `Taint` to compute caches. 39 - Thread caches into `runInterProc` and config-aware variants. 40 - Preserve existing APIs where possible; add internal variants if 41 needed. 42 43 ## Risks 44 45 - Incorrect function boundary detection could change analysis coverage. 46 Use existing `isFunctionLabel` semantics to derive ranges. 47 - Memory overhead is minimal compared to analysis state.