-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Reland "[pkg/vm] Handle switch statements in unreachable code…
… eliminator."" This reverts commit 2623117. Reason for revert: Breaks legacy mode. Bug: #54029 Original change's description: > Reland "[pkg/vm] Handle switch statements in unreachable code eliminator." > > This is a reland of commit 92bf76d > > In the original CL, the changes to the UCE assumed all > SwitchStatements were exhaustive. Now if a SwitchStatement isn't > explicitly or implicitly (via a default case) exhaustive and no case > matches the tested constant, the SwitchStatement is properly removed. > > In addition, if a guaranteed to match case is found, more than one > cases remain (thus the SwitchStatement is not removed or replaced with > the single case's body), and the default case is removed, then the > resulting SwitchStatement is marked as explicitly exhaustive, as this > serves as a signal to backends that they do not need to handle the > possibility of no case matching in the absence of a default case. > > Original change's description: > > [pkg/vm] Handle switch statements in unreachable code eliminator. > > > > Namely, if the tested expression for a switch statement is constant, > > then we can remove any constant cases where the constants differ, > > and if all but a single case is removed, we can replace the switch > > with the case body. > > > > If constant functions are not enabled, then getters annotated with > > @pragma("vm:platform-const") are still evaluated with the constant > > function evaluation machinery, but only those and no others (including > > any functions called within an annotated getter). This way, functions > > can be annotated with @pragma("vm:platform-const") without having to > > rewrite them to be a single returned expression. > > > > TEST=pkg/vm/test/transformations/unreachable_code_elimination > > pkg/vm/test/transformations/vm_constant_evaluator > > > > Issue: #50473 > > Issue: #31969 > > Change-Id: Ie290d2f1f469326238d66c3d9631f8e696685ff0 > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332760 > > Commit-Queue: Tess Strickland <sstrickl@google.com> > > Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> > > Reviewed-by: Alexander Markov <alexmarkov@google.com> > > TEST=pkg/vm/test/transformations/unreachable_code_elimination > pkg/vm/test/transformations/vm_constant_evaluator > > Issue: #50473 > Issue: #31969 > Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try > Change-Id: I557ca933808012e670e306f2d880221a0d7dd670 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334224 > Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> > Reviewed-by: Alexander Markov <alexmarkov@google.com> > Commit-Queue: Tess Strickland <sstrickl@google.com> Issue: #50473 Issue: #31969 Change-Id: I56373c7a6feac76e23c1800ae83eb013c5856cba Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335820 Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
- Loading branch information
Showing
12 changed files
with
156 additions
and
1,199 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.