fix(minifier): inline multiple variable declarations at once#13477
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
7c96301 to
5990f17
Compare
ff4180d to
ff425d0
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a dead code elimination (DCE) issue where multiple variable declarations were not inlined in a single pass. The minifier now iteratively processes variable declarations to fully inline multiple unused variables at once, improving the optimization efficiency.
- Modified the inlining logic to use a loop instead of single-pass processing
- Added comprehensive test coverage for the multi-iteration DCE scenario
- Changed return logic to track whether any inlining occurred across iterations
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/oxc_minifier/src/peephole/minimize_statements.rs | Updated variable inlining logic to process multiple declarations iteratively |
| crates/oxc_minifier/tests/peephole/dead_code_elimination.rs | Added test case with 20 variables to verify multi-iteration DCE behavior |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
CodSpeed Instrumentation Performance ReportMerging #13477 will not alter performanceComparing Summary
Footnotes |
Merge activity
|
Codes like: ```js var a1 = 'a1' var a2 = 'a2' var a3 = 'a3' var arr = [ a1, a2, a3, ] console.log(arr) ``` was not processes at once for DCE because DCE does not join variable declarations. This PR fixes that.
ff425d0 to
946669b
Compare

Codes like:
was not processed at once for DCE because DCE does not join variable declarations.
This PR fixes that.