Author :
Shahbaz Youssefi
Date :
2021-08-05 23:49:23
Hash :63248e7f Message :Translator: Fix dead-code-elimination corner case
The DCE code had a corner case bug where a switch case containing
multiple DCE'ed `break`s followed by another case would cause some of
the DCE'ed statements in the first case to be doubly pruned, failing on
an assertion.
This was due to the fact that visitBlock() was asking traversal to
continue if a new case was visited while pruning nodes, but the
traversal does not take into account that some statements need to be
skipped and so would also visit the pruned statements. If the pruned
statements contain a branch instruction, they get re-pruned.
The visitBlock() function that does the pruning is reworked so that it
more clearly traverses the statements.
Bug: chromium:1237200
Change-Id: Ib078c2ea73ade756c7d7ef5a5c489fa53c39f352
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3077659
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>