This MR reduces code generation time with -finfo-table-map by 30% with -O0 and 60% with -O1 (based on tests with check-exact). Info table map generation was previously done with a separate traversal of the generated Cmm code, using the inefficient mapAccumL_
function on the stream. This MR fuses that traversal with the main traversal in GHC.Driver.Main
to pre-compute the map from info tables to estimated source positions. That precomputed map is then given to generateCgIPEStub
, which now simply yields the IPE CmmGroupSRTs
into the stream instead of traversing it.
In a test on the Agda codebase, this shaved 20s off the build time when -finfo-table-map
was enabled (380s down to 360s).
Fixes #23103 (closed)