summaryrefslogtreecommitdiffstats
path: root/tests/cpp-compiler
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2020-12-07 18:18:31 -0800
committerGitHub <noreply@github.com>2020-12-07 18:18:31 -0800
commitb8e1f62fb9cc66481b35231149448e47f096d257 (patch)
tree4b12bca0e0648fb4424e6e0a0f3803c241b7b66e /tests/cpp-compiler
parent0404fefd7f783d43b5bb636383797adbd593af51 (diff)
Fix a subtle bug introduced into type legalization (#1632)
The refactor of type legalization in PR #1594 introduced a subtle problem where an IR instruction might be removed from the hierachy (perhaps because its parent was removed during legalization) but would still be on the work list. Legalization of such instructions is wasteful (since it would never impact the output), but it also creates a problem if we try to insert new legalized instructions next to such a removed instruction. The logic for inserting an instruction before/after another asserts that the sibling instruction must have a parent, and leads to a failure in debug builds and a potential crash in release builds. This change adds a bit of defensive code to skip any instructions that appear to have been removed from the hierarchy (because they have no parent and are not the root/module instruction). An alternative approach would be to try to detect these instructions at the point where they would be added to the work list, but this approach seems simpler and more general.
Diffstat (limited to 'tests/cpp-compiler')
0 files changed, 0 insertions, 0 deletions