| Index: src/hydrogen-gvn.cc
|
| diff --git a/src/hydrogen-gvn.cc b/src/hydrogen-gvn.cc
|
| index 02b3a0a2c94dc217f625f78556cf1ab8cb0e95c1..3ad93129cd9c981fd9d61784ce1011335a21d4a9 100644
|
| --- a/src/hydrogen-gvn.cc
|
| +++ b/src/hydrogen-gvn.cc
|
| @@ -412,10 +412,13 @@ void HGlobalValueNumberingPhase::ComputeBlockSideEffects() {
|
|
|
| // Propagate loop side effects upwards.
|
| if (block->HasParentLoopHeader()) {
|
| - int header_id = block->parent_loop_header()->block_id();
|
| - loop_side_effects_[header_id].Add(block->IsLoopHeader()
|
| - ? loop_side_effects_[id]
|
| - : side_effects);
|
| + HBasicBlock* with_parent = block;
|
| + if (block->IsLoopHeader()) side_effects = loop_side_effects_[id];
|
| + do {
|
| + HBasicBlock* parent_block = with_parent->parent_loop_header();
|
| + loop_side_effects_[parent_block->block_id()].Add(side_effects);
|
| + with_parent = parent_block;
|
| + } while (with_parent->HasParentLoopHeader());
|
| }
|
| }
|
| }
|
| @@ -517,7 +520,7 @@ void HGlobalValueNumberingPhase::LoopInvariantCodeMotion() {
|
| GVNFlagSet side_effects = loop_side_effects_[block->block_id()];
|
| TRACE_GVN_2("Try loop invariant motion for block B%d %s\n",
|
| block->block_id(),
|
| - *GetGVNFlagsString(side_effects));
|
| + GetGVNFlagsString(side_effects).get());
|
|
|
| GVNFlagSet accumulated_first_time_depends;
|
| GVNFlagSet accumulated_first_time_changes;
|
| @@ -542,7 +545,7 @@ void HGlobalValueNumberingPhase::ProcessLoopBlock(
|
| GVNFlagSet depends_flags = HValue::ConvertChangesToDependsFlags(loop_kills);
|
| TRACE_GVN_2("Loop invariant motion for B%d %s\n",
|
| block->block_id(),
|
| - *GetGVNFlagsString(depends_flags));
|
| + GetGVNFlagsString(depends_flags).get());
|
| HInstruction* instr = block->first();
|
| while (instr != NULL) {
|
| HInstruction* next = instr->next();
|
| @@ -551,8 +554,8 @@ void HGlobalValueNumberingPhase::ProcessLoopBlock(
|
| TRACE_GVN_4("Checking instruction %d (%s) %s. Loop %s\n",
|
| instr->id(),
|
| instr->Mnemonic(),
|
| - *GetGVNFlagsString(instr->gvn_flags()),
|
| - *GetGVNFlagsString(loop_kills));
|
| + GetGVNFlagsString(instr->gvn_flags()).get(),
|
| + GetGVNFlagsString(loop_kills).get());
|
| bool can_hoist = !instr->gvn_flags().ContainsAnyOf(depends_flags);
|
| if (can_hoist && !graph()->use_optimistic_licm()) {
|
| can_hoist = block->IsLoopSuccessorDominator();
|
| @@ -567,7 +570,8 @@ void HGlobalValueNumberingPhase::ProcessLoopBlock(
|
| }
|
|
|
| if (inputs_loop_invariant && ShouldMove(instr, loop_header)) {
|
| - TRACE_GVN_1("Hoisting loop invariant instruction %d\n", instr->id());
|
| + TRACE_GVN_2("Hoisting loop invariant instruction i%d to block B%d\n",
|
| + instr->id(), pre_header->block_id());
|
| // Move the instruction out of the loop.
|
| instr->Unlink();
|
| instr->InsertBefore(pre_header->end());
|
| @@ -585,11 +589,11 @@ void HGlobalValueNumberingPhase::ProcessLoopBlock(
|
| first_time_changes->Add(instr->ChangesFlags());
|
| if (!(previous_depends == *first_time_depends)) {
|
| TRACE_GVN_1("Updated first-time accumulated %s\n",
|
| - *GetGVNFlagsString(*first_time_depends));
|
| + GetGVNFlagsString(*first_time_depends).get());
|
| }
|
| if (!(previous_changes == *first_time_changes)) {
|
| TRACE_GVN_1("Updated first-time accumulated %s\n",
|
| - *GetGVNFlagsString(*first_time_changes));
|
| + GetGVNFlagsString(*first_time_changes).get());
|
| }
|
| }
|
| instr = next;
|
| @@ -801,7 +805,7 @@ void HGlobalValueNumberingPhase::AnalyzeGraph() {
|
| map->Kill(flags);
|
| dominators->Store(flags, instr);
|
| TRACE_GVN_2("Instruction %d %s\n", instr->id(),
|
| - *GetGVNFlagsString(flags));
|
| + GetGVNFlagsString(flags).get());
|
| }
|
| if (instr->CheckFlag(HValue::kUseGVN)) {
|
| ASSERT(!instr->HasObservableSideEffects());
|
|
|