diff options
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/ssa_builder.cc | 7 | ||||
-rw-r--r-- | compiler/optimizing/ssa_type_propagation.cc | 10 |
2 files changed, 8 insertions, 9 deletions
diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc index fec40f93c7..b2cc11996e 100644 --- a/compiler/optimizing/ssa_builder.cc +++ b/compiler/optimizing/ssa_builder.cc @@ -183,8 +183,7 @@ static HDoubleConstant* GetDoubleEquivalent(HLongConstant* constant) { static HPhi* GetFloatOrDoubleEquivalentOfPhi(HPhi* phi, Primitive::Type type) { // We place the floating point phi next to this phi. HInstruction* next = phi->GetNext(); - if (next == nullptr - || (next->GetType() != Primitive::kPrimDouble && next->GetType() != Primitive::kPrimFloat)) { + if (next == nullptr || (next->AsPhi()->GetRegNumber() != phi->GetRegNumber())) { ArenaAllocator* allocator = phi->GetBlock()->GetGraph()->GetArena(); HPhi* new_phi = new (allocator) HPhi(allocator, phi->GetRegNumber(), phi->InputCount(), type); for (size_t i = 0, e = phi->InputCount(); i < e; ++i) { @@ -195,9 +194,7 @@ static HPhi* GetFloatOrDoubleEquivalentOfPhi(HPhi* phi, Primitive::Type type) { phi->GetBlock()->InsertPhiAfter(new_phi, phi); return new_phi; } else { - // If there is already a phi with the expected type, we know it is the floating - // point equivalent of this phi. - DCHECK_EQ(next->AsPhi()->GetRegNumber(), phi->GetRegNumber()); + DCHECK_EQ(next->GetType(), type); return next->AsPhi(); } } diff --git a/compiler/optimizing/ssa_type_propagation.cc b/compiler/optimizing/ssa_type_propagation.cc index 3828142ed2..cb5ce20c46 100644 --- a/compiler/optimizing/ssa_type_propagation.cc +++ b/compiler/optimizing/ssa_type_propagation.cc @@ -90,10 +90,12 @@ void SsaTypePropagation::VisitBasicBlock(HBasicBlock* block) { } } else { for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { - HPhi* phi = it.Current()->AsPhi(); - if (UpdateType(phi)) { - AddDependentInstructionsToWorklist(phi); - } + // Eagerly compute the type of the phi, for quicker convergence. Note + // that we don't need to add users to the worklist because we are + // doing a reverse post-order visit, therefore either the phi users are + // non-loop phi and will be visited later in the visit, or are loop-phis, + // and they are already in the work list. + UpdateType(it.Current()->AsPhi()); } } } |