diff options
author | David Brazdil <dbrazdil@google.com> | 2015-04-20 14:52:42 +0100 |
---|---|---|
committer | David Brazdil <dbrazdil@google.com> | 2015-04-24 16:19:31 +0100 |
commit | 2d7352ba5311b8f57427b91b7a891e61497373c1 (patch) | |
tree | 3f3426f4f30663ee252ebc1f02ecd0eb114bad85 /compiler/utils | |
parent | c5cb691ca6a746a193bfbe3525aafa7cbb281d40 (diff) | |
download | android_art-2d7352ba5311b8f57427b91b7a891e61497373c1.tar.gz android_art-2d7352ba5311b8f57427b91b7a891e61497373c1.tar.bz2 android_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/utils')
-rw-r--r-- | compiler/utils/growable_array.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/utils/growable_array.h b/compiler/utils/growable_array.h index 821e28b4a0..e4b1e7d0e9 100644 --- a/compiler/utils/growable_array.h +++ b/compiler/utils/growable_array.h @@ -46,6 +46,14 @@ class GrowableArray : public ArenaObject<kArenaAllocGrowableArray> { } } + bool Contains(T value) const { + for (size_t i = 0; i < num_used_; ++i) { + if (elem_list_[i] == value) { + return true; + } + } + return false; + } // Expand the list size to at least new length. void Resize(size_t new_length) { |