chore: park the unused Lua-level DCE on the lua-dce-wip branch#135
Merged
Conversation
The pass has been unplugged from the pipeline since 189173d (Jul 2023), when the IR-level DCE over the UberModule took over, and the 2026-07-02 backend audit showed it would miscompile if re-enabled (PreserveReturned drops all top-level field assignments). Moved to the lua-dce-wip branch with its defect list documented; a pointer comment in compileModules marks where it would be wired back.
There was a problem hiding this comment.
Pull request overview
This PR removes the unused Lua-level dead-code-elimination pass (Language.PureScript.Backend.Lua.DCE) and its now-orphaned test support from main, while leaving an inline pointer in the compilation pipeline to the preserved lua-dce-wip branch for future work/audits.
Changes:
- Drop
Language.PureScript.Backend.Lua.DCEfrom the library and delete its spec and generators (previously only used by that spec). - Update the spec test runner (
test/Main.hs) andpslua.cabalregistrations accordingly. - Add a comment in
compileModulesindicating where the Lua-level DCE used to run and where it can be found now.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
test/Main.hs |
Removes the Lua DCE spec from the test runner. |
test/Language/PureScript/Backend/Lua/Gen.hs |
Deletes the Lua AST generators used only by the removed DCE spec. |
test/Language/PureScript/Backend/Lua/DCE/Spec.hs |
Deletes the unreachable Lua DCE spec. |
pslua.cabal |
Unregisters the removed Lua DCE module/spec/gen from build plans. |
lib/Language/PureScript/Backend/Lua/DCE.hs |
Deletes the unused Lua-level DCE implementation. |
lib/Language/PureScript/Backend.hs |
Adds an in-pipeline comment pointing to the parked Lua DCE work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Language.PureScript.Backend.Lua.DCEhas not been part of the pipeline since 189173d (Jul 2023, #3), when the IR-level DCE over the UberModule took over; its only consumer was its own spec. A backend audit on 2026-07-02 also showed the pass would miscompile if somebody re-enabled it as is: inPreserveReturnedmode it eliminates every top-level binding, because bindings are emitted as field assignments (M.Main_foo = ...) while the dependency graph only creates incoming edges forVarNameassignments.Rather than deleting the work or keeping a trap on
main, this PR moves the module aside:lua-dce-wipbranch preserves the module, its spec, and theLua.Gentest generators, plus a commit extending Note [Graph-based dead code elimination for Lua] with the audit's defect list (thePreserveReturnedissue above, the shape-dependent scope bookkeeping,local x = xself-resolution, and scope-blindfindAssignments), so future work starts from a written down list instead of rediscovering them.maindropsLua/DCE.hs,Lua/DCE/Spec.hs, andLua/Gen.hs(used only by that spec), unregisters them frompslua.cabalandtest/Main.hs, and leaves a pointer comment incompileModulesat the exact spot the pass used to occupy, referencing the branch.No behavior change: the module was unreachable from the executable. Test suite passes (309 examples).