Skip to content

chore: park the unused Lua-level DCE on the lua-dce-wip branch#135

Merged
Unisay merged 1 commit into
mainfrom
chore/park-lua-dce
Jul 2, 2026
Merged

chore: park the unused Lua-level DCE on the lua-dce-wip branch#135
Unisay merged 1 commit into
mainfrom
chore/park-lua-dce

Conversation

@Unisay

@Unisay Unisay commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Language.PureScript.Backend.Lua.DCE has 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: in PreserveReturned mode it eliminates every top-level binding, because bindings are emitted as field assignments (M.Main_foo = ...) while the dependency graph only creates incoming edges for VarName assignments.

Rather than deleting the work or keeping a trap on main, this PR moves the module aside:

  • The lua-dce-wip branch preserves the module, its spec, and the Lua.Gen test generators, plus a commit extending Note [Graph-based dead code elimination for Lua] with the audit's defect list (the PreserveReturned issue above, the shape-dependent scope bookkeeping, local x = x self-resolution, and scope-blind findAssignments), so future work starts from a written down list instead of rediscovering them.
  • main drops Lua/DCE.hs, Lua/DCE/Spec.hs, and Lua/Gen.hs (used only by that spec), unregisters them from pslua.cabal and test/Main.hs, and leaves a pointer comment in compileModules at 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).

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.
@Unisay Unisay self-assigned this Jul 2, 2026
@Unisay Unisay requested a review from Copilot July 2, 2026 08:37
@Unisay Unisay marked this pull request as ready for review July 2, 2026 08:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.DCE from the library and delete its spec and generators (previously only used by that spec).
  • Update the spec test runner (test/Main.hs) and pslua.cabal registrations accordingly.
  • Add a comment in compileModules indicating 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.

Comment thread lib/Language/PureScript/Backend.hs
@Unisay Unisay merged commit 3f2a5ca into main Jul 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants