Skip to content

Simplify boolean expressions in Java AST#10279

Merged
zbynek merged 2 commits intogwtproject:mainfrom
zbynek:dce-bool
Apr 23, 2026
Merged

Simplify boolean expressions in Java AST#10279
zbynek merged 2 commits intogwtproject:mainfrom
zbynek:dce-bool

Conversation

@zbynek
Copy link
Copy Markdown
Collaborator

@zbynek zbynek commented Feb 20, 2026

Split from #10261 (see comments in that PR for discussion).

Fixes #10278

Comment thread dev/core/src/com/google/gwt/dev/jjs/impl/Simplifier.java Outdated
Comment thread dev/core/test/com/google/gwt/dev/jjs/impl/DeadCodeEliminationTest.java Outdated
Comment thread dev/core/test/com/google/gwt/dev/jjs/impl/DeadCodeEliminationTest.java Outdated
@zbynek
Copy link
Copy Markdown
Collaborator Author

zbynek commented Feb 23, 2026

Stats for GeoGebra main chunk

before:
pretty:21671810
obfuscated:7864283
gzipped:2554348

after:
pretty:21670169
obfuscated:7863399
gzipped:2553679

So this seems to be just .03% improvement.

@niloc132
Copy link
Copy Markdown
Member

So this seems to be just .03% improvement.

Right, most of these are going to be tiny on their own, or will depend on the specific code being compiled repeating this pattern.

I still think changes like this in pattern matching simple code is worth it - we're adding a single if in an edge case, and DCE is specifically designed to converge in a single pass (though other optimizations can interact with it and require another later pass). The theory is that if we find other code later that can be rewritten trivially to false/true, we will get to propagate that out and clean up other code - and now that will even work if the boolean is trapped in a multiexpr.

@zbynek zbynek merged commit 7096a3f into gwtproject:main Apr 23, 2026
5 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.

Improve simplification of boolean expressions in Java AST

2 participants