summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/boolean_simplifier.cc
diff options
context:
space:
mode:
authorDavid Brazdil <dbrazdil@google.com>2015-04-20 14:52:42 +0100
committerDavid Brazdil <dbrazdil@google.com>2015-04-24 16:19:31 +0100
commit2d7352ba5311b8f57427b91b7a891e61497373c1 (patch)
tree3f3426f4f30663ee252ebc1f02ecd0eb114bad85 /compiler/optimizing/boolean_simplifier.cc
parentc5cb691ca6a746a193bfbe3525aafa7cbb281d40 (diff)
downloadart-2d7352ba5311b8f57427b91b7a891e61497373c1.tar.gz
art-2d7352ba5311b8f57427b91b7a891e61497373c1.tar.bz2
art-2d7352ba5311b8f57427b91b7a891e61497373c1.zip
ART: Dead block removal
Adds a new pass which finds all unreachable blocks, typically due to simplifying an if-condition to a constant, and removes them from the graph. The patch also slightly generalizes the graph-transforming operations. Change-Id: Iff7c97f1d10b52886f3cd7401689ebe1bfdbf456
Diffstat (limited to 'compiler/optimizing/boolean_simplifier.cc')
-rw-r--r--compiler/optimizing/boolean_simplifier.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/optimizing/boolean_simplifier.cc b/compiler/optimizing/boolean_simplifier.cc
index 6ebfb45074..30c89f2d15 100644
--- a/compiler/optimizing/boolean_simplifier.cc
+++ b/compiler/optimizing/boolean_simplifier.cc
@@ -120,8 +120,11 @@ void HBooleanSimplifier::Run() {
phi->ReplaceWith(replacement);
merge_block->RemovePhi(phi);
- // Link the start/end blocks and remove empty branches.
- graph_->MergeEmptyBranches(block, merge_block);
+ // Delete the true branch and merge the resulting chain of blocks
+ // 'block->false_block->merge_block' into one.
+ true_block->DisconnectAndDelete();
+ block->MergeWith(false_block);
+ block->MergeWith(merge_block);
// Remove the original condition if it is now unused.
if (!if_condition->HasUses()) {