diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-09-29 12:00:40 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-09-30 13:50:38 +0100 |
commit | 8ddb00ca935733f5d3b07816e5bb33d6cabe6ec4 (patch) | |
tree | 9bca67b136523eb31aab736988143295ece97b56 /compiler/optimizing/ssa_liveness_analysis.h | |
parent | cc6b59ee25d7b9782cc971687715d664a97b05bd (diff) | |
download | art-8ddb00ca935733f5d3b07816e5bb33d6cabe6ec4.zip art-8ddb00ca935733f5d3b07816e5bb33d6cabe6ec4.tar.gz art-8ddb00ca935733f5d3b07816e5bb33d6cabe6ec4.tar.bz2 |
Improve detection of lifetime holes.
The check concluding that the next use was in a successor
was too conservative: two blocks following each other
in terms of liveness are not necessarily predecessor/sucessor.
Change-Id: Ideec98046c812aa5fb63781141b5fde24c706d6d
Diffstat (limited to 'compiler/optimizing/ssa_liveness_analysis.h')
-rw-r--r-- | compiler/optimizing/ssa_liveness_analysis.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/compiler/optimizing/ssa_liveness_analysis.h b/compiler/optimizing/ssa_liveness_analysis.h index 3ef2413..c62e61b 100644 --- a/compiler/optimizing/ssa_liveness_analysis.h +++ b/compiler/optimizing/ssa_liveness_analysis.h @@ -183,8 +183,6 @@ class LiveInterval : public ArenaObject { // or its output to the same register. ++position; } - size_t start_block_position = instruction->GetBlock()->GetLifetimeStart(); - size_t end_block_position = instruction->GetBlock()->GetLifetimeEnd(); if ((first_use_ != nullptr) && (first_use_->GetUser() == instruction) && (first_use_->GetPosition() < position)) { @@ -200,18 +198,25 @@ class LiveInterval : public ArenaObject { return; } + size_t start_block_position = instruction->GetBlock()->GetLifetimeStart(); if (first_range_ == nullptr) { // First time we see a use of that interval. - first_range_ = last_range_ = new (allocator_) LiveRange(start_block_position, position, nullptr); + first_range_ = last_range_ = new (allocator_) LiveRange( + start_block_position, position, nullptr); } else if (first_range_->GetStart() == start_block_position) { - // There is a use later in the same block. + // There is a use later in the same block or in a following block. + // Note that in such a case, `AddRange` for the whole blocks has been called + // before arriving in this method, and this is the reason the start of + // `first_range_` is before the given `position`. DCHECK_LE(position, first_range_->GetEnd()); - } else if (first_range_->GetStart() == end_block_position) { - // Last use is in the following block. - first_range_->start_ = start_block_position; } else { DCHECK(first_range_->GetStart() > position); // There is a hole in the interval. Create a new range. + // Note that the start of `first_range_` can be equal to `end`: two blocks + // having adjacent lifetime positions are not necessarily + // predecessor/successor. When two blocks are predecessor/successor, the + // liveness algorithm has called `AddRange` before arriving in this method, + // and the check line 205 would succeed. first_range_ = new (allocator_) LiveRange(start_block_position, position, first_range_); } first_use_ = new (allocator_) UsePosition( |