summaryrefslogtreecommitdiff
path: root/compiler/optimizing/gvn.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2016-05-10 14:35:34 +0100
committer Nicolas Geoffray <ngeoffray@google.com> 2016-05-11 09:54:19 +0100
commit77ce6430af2709432b22344ed656edd8ec80581b (patch)
treea11f05756407cf9ccd5bd03d5f466f4bb727fcc4 /compiler/optimizing/gvn.cc
parentf11e5473461d9f33d4427187fb945a1edcf2ef34 (diff)
Fix another case of live_in at irreducible loop entry.
GVN was implicitly extending the liveness of an instruction across an irreducible loop. Fix this problem by clearing the value set at loop entries that contain an irreducible loop. bug:28252896 Change-Id: I68823cb88dceb4c2b4545286ba54fd0c958a48b0
Diffstat (limited to 'compiler/optimizing/gvn.cc')
-rw-r--r--compiler/optimizing/gvn.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/optimizing/gvn.cc b/compiler/optimizing/gvn.cc
index d0d52bf6cc..1e86b75075 100644
--- a/compiler/optimizing/gvn.cc
+++ b/compiler/optimizing/gvn.cc
@@ -454,11 +454,16 @@ void GlobalValueNumberer::VisitBasicBlock(HBasicBlock* block) {
if (!set->IsEmpty()) {
if (block->IsLoopHeader()) {
- if (block->GetLoopInformation()->IsIrreducible()) {
+ if (block->GetLoopInformation()->ContainsIrreducibleLoop()) {
// To satisfy our linear scan algorithm, no instruction should flow in an irreducible
- // loop header.
+ // loop header. We clear the set at entry of irreducible loops and any loop containing
+ // an irreducible loop, as in both cases, GVN can extend the liveness of an instruction
+ // across the irreducible loop.
+ // Note that, if we're not compiling OSR, we could still do GVN and introduce
+ // phis at irreducible loop headers. We decided it was not worth the complexity.
set->Clear();
} else {
+ DCHECK(!block->GetLoopInformation()->IsIrreducible());
DCHECK_EQ(block->GetDominator(), block->GetLoopInformation()->GetPreHeader());
set->Kill(side_effects_.GetLoopEffects(block));
}