Title: Normalize generated names in golden.ir dumps to eliminate index churn · Issue #333 · purescript-lua/purescript-lua · GitHub
Open Graph Title: Normalize generated names in golden.ir dumps to eliminate index churn · Issue #333 · purescript-lua/purescript-lua
X Title: Normalize generated names in golden.ir dumps to eliminate index churn · Issue #333 · purescript-lua/purescript-lua
Description: Problem Generated names in the IR — CSE binders ($cseN), uniquification and uncurry suffixes — are minted from one supply that spans the whole uber-module compilation, so any change to how many names an earlier pass or an earlier binding...
Open Graph Description: Problem Generated names in the IR — CSE binders ($cseN), uniquification and uncurry suffixes — are minted from one supply that spans the whole uber-module compilation, so any change to how many nam...
X Description: Problem Generated names in the IR — CSE binders ($cseN), uniquification and uncurry suffixes — are minted from one supply that spans the whole uber-module compilation, so any change to how many nam...
Opengraph URL: https://github.com/purescript-lua/purescript-lua/issues/333
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Normalize generated names in golden.ir dumps to eliminate index churn","articleBody":"## Problem\n\nGenerated names in the IR — CSE binders (`$cseN`), uniquification and uncurry suffixes — are minted from one supply that spans the whole uber-module compilation, so any change to how many names an earlier pass or an earlier binding mints renumbers everything after it. The committed `golden.ir` files print these names verbatim, which turns every optimizer change into corpus-wide index churn: PR #327 touched 45 golden.ir files, and some of them contain nothing but renumbering — `Golden.CasePruning.Test/golden.ir`'s entire diff is `$cse249 → $cse244` and `$cse248 → $cse243`, alpha-equivalent IR with zero semantic change. The noise buries the diffs a reviewer actually needs to read. The Lua goldens do not have this problem: Lua codegen renumbers locals per scope (`x_S_0`, `_S_cse0` restart within each function), so a change in one binding cannot rename anything in another.\n\n## Approach\n\nNormalize in the golden harness only, before pretty-printing: alpha-rename generated names deterministically with a counter that resets per top-level binding, assigning numbers in first-occurrence order within the binding. Post-uniquification, generated locals are referenced only within their own binding (cross-binding references go by qualified name), so per-binding renumbering preserves alpha-equivalence and contains any churn to the binding that genuinely changed — the IR analogue of the Lua `_S_N` behavior. The compiler pipeline keeps its globally unique names untouched; only the golden representation stabilizes. One final re-acceptance of all golden.ir files lands the normalized baseline.\n\n## Prerequisites / Relations\n\nMotivated by the churn in PR #327; independent of the directive machinery. Touches only the golden Spec's dump path.\n\n## Verification / Measurement\n\nA deliberate inlining perturbation in one golden module leaves every other module's golden.ir byte-identical (today it renumbers them); re-running the suite twice over the normalized goldens is stable; a unit test pins the normalizer on a two-binding module where the first binding's name count changes.\n","author":{"url":"https://github.com/Unisay","@type":"Person","name":"Unisay"},"datePublished":"2026-07-28T10:17:04Z","url":"https://github.com/purescript-lua/purescript-lua/issues/333"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:988226a4-9e4f-7e67-5a8a-7a824ef7e1bc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9668:E3C4F:54248B:6D5655:6B00DB71 |
| html-safe-nonce | e413b8f524cefc483ccd690346f4e04d01a59258f79022396da34432a851c567 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjY4OkUzQzRGOjU0MjQ4Qjo2RDU2NTU6NkIwMERCNzEiLCJ2aXNpdG9yX2lkIjoiMzc4OTkyNDE4OTQwMjYxODczNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7d17cb06995c3aa91ce482aba1944e77840a695615be47861fe2e410c4b8c9c6 |
| hovercard-subject-tag | issue:4997443842 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/purescript-lua/purescript-lua/333/issue_layout |
| twitter:image | https://opengraph.githubassets.com/aa92860b0a8ab8e508b28dd7c87aba32f2a55f8cf501bd20130fd9ca4e3fb00b/purescript-lua/purescript-lua/issues/333 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/aa92860b0a8ab8e508b28dd7c87aba32f2a55f8cf501bd20130fd9ca4e3fb00b/purescript-lua/purescript-lua/issues/333 |
| og:image:alt | Problem Generated names in the IR — CSE binders ($cseN), uniquification and uncurry suffixes — are minted from one supply that spans the whole uber-module compilation, so any change to how many nam... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Unisay |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| turbo-cache-control | no-preview |
| go-import | github.com/purescript-lua/purescript-lua git https://github.com/purescript-lua/purescript-lua.git |
| octolytics-dimension-user_id | 131581790 |
| octolytics-dimension-user_login | purescript-lua |
| octolytics-dimension-repository_id | 587200487 |
| octolytics-dimension-repository_nwo | purescript-lua/purescript-lua |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 587200487 |
| octolytics-dimension-repository_network_root_nwo | purescript-lua/purescript-lua |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width