-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UnreachableCodeElimination: Avoid traversing unreachable statements
When traversing a block of statements, skip traversal of all statements following the first one we find to be unreachable and remove them all. This avoids unnecessary work traversing the individual statements that we already know will not ever execute. This change also fixes a bug that caused unreachable `do {} while (condition)` statements to be left behind. This could cause an undeclared variable reference if the condition referred to a `let` or `const` variable whose declaration was also removed as unreachable. That bug was the original motivation for this change. PiperOrigin-RevId: 565691433
- Loading branch information
1 parent
5080646
commit 0e9335f
Showing
2 changed files
with
151 additions
and
16 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