diff options
author | Max Kazantsev <max.kazantsev@azul.com> | 2019-01-14 10:26:26 +0000 |
---|---|---|
committer | Max Kazantsev <max.kazantsev@azul.com> | 2019-01-14 10:26:26 +0000 |
commit | 1f73310e1e8cd8943ac59ede3d4927bf7f341531 (patch) | |
tree | 15b628c4c7e27c10bcdb87883d27cecd44d6b943 /lldb/packages/Python/lldbsuite/test/python_api/value/main.c | |
parent | 17121adfa607b1d70300e88925767626333cf730 (diff) | |
download | bcm5719-llvm-1f73310e1e8cd8943ac59ede3d4927bf7f341531.tar.gz bcm5719-llvm-1f73310e1e8cd8943ac59ede3d4927bf7f341531.zip |
[BasicBlockUtils] Generalize DeleteDeadBlock to deal with multiple dead blocks
Utility function `DeleteDeadBlock` expects that all predecessors of a block being
deleted are already deleted, with the exception of single-block loop. It makes it
hard to use for deletion of a set of blocks that may contain cyclic dependencies.
The is no correct order of invocations of this function that does not produce
dangling pointers on already deleted blocks.
This patch introduces a generalized version of this function `DeleteDeadBlocks`
that allows us to remove multiple blocks at once, even if there are cycles among
them. The only requirement is that no block being deleted should have a predecessor
that is not being deleted.
The logic of `DeleteDeadBlocks` is following:
for each block
create relevant DT updates;
remove all instructions (replace with undef if needed);
replace terminator with unreacheable;
apply DT updates;
for each block
delete block;
Therefore, `DeleteDeadBlock` becomes a particular case of
the general algorithm called for a single block.
Differential Revision: https://reviews.llvm.org/D56120
Reviewed By: skatkov
llvm-svn: 351045
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/value/main.c')
0 files changed, 0 insertions, 0 deletions