Commit a7ead167 authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

Really skip dead blocks in GVN

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/194413002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19779 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b5f3020c
...@@ -592,7 +592,9 @@ void HGlobalValueNumberingPhase::LoopInvariantCodeMotion() { ...@@ -592,7 +592,9 @@ void HGlobalValueNumberingPhase::LoopInvariantCodeMotion() {
graph()->use_optimistic_licm() ? "yes" : "no"); graph()->use_optimistic_licm() ? "yes" : "no");
for (int i = graph()->blocks()->length() - 1; i >= 0; --i) { for (int i = graph()->blocks()->length() - 1; i >= 0; --i) {
HBasicBlock* block = graph()->blocks()->at(i); HBasicBlock* block = graph()->blocks()->at(i);
if (block->IsLoopHeader()) { if (block->IsLoopHeader() &&
block->IsReachable() &&
!block->IsDeoptimizing()) {
SideEffects side_effects = loop_side_effects_[block->block_id()]; SideEffects side_effects = loop_side_effects_[block->block_id()];
if (FLAG_trace_gvn) { if (FLAG_trace_gvn) {
HeapStringAllocator allocator; HeapStringAllocator allocator;
...@@ -616,6 +618,7 @@ void HGlobalValueNumberingPhase::ProcessLoopBlock( ...@@ -616,6 +618,7 @@ void HGlobalValueNumberingPhase::ProcessLoopBlock(
HBasicBlock* block, HBasicBlock* block,
HBasicBlock* loop_header, HBasicBlock* loop_header,
SideEffects loop_kills) { SideEffects loop_kills) {
if (!block->IsReachable() || block->IsDeoptimizing()) return;
HBasicBlock* pre_header = loop_header->predecessors()->at(0); HBasicBlock* pre_header = loop_header->predecessors()->at(0);
if (FLAG_trace_gvn) { if (FLAG_trace_gvn) {
HeapStringAllocator allocator; HeapStringAllocator allocator;
...@@ -680,10 +683,8 @@ bool HGlobalValueNumberingPhase::AllowCodeMotion() { ...@@ -680,10 +683,8 @@ bool HGlobalValueNumberingPhase::AllowCodeMotion() {
bool HGlobalValueNumberingPhase::ShouldMove(HInstruction* instr, bool HGlobalValueNumberingPhase::ShouldMove(HInstruction* instr,
HBasicBlock* loop_header) { HBasicBlock* loop_header) {
// If we've disabled code motion or we're in a block that unconditionally // If we've disabled code motion, don't move any instructions.
// deoptimizes, don't move any instructions. return AllowCodeMotion();
return AllowCodeMotion() && !instr->block()->IsDeoptimizing() &&
instr->block()->IsReachable();
} }
...@@ -776,20 +777,18 @@ class GvnBasicBlockState: public ZoneObject { ...@@ -776,20 +777,18 @@ class GvnBasicBlockState: public ZoneObject {
} }
GvnBasicBlockState* next_dominated(Zone* zone) { GvnBasicBlockState* next_dominated(Zone* zone) {
dominated_index_++; while (++dominated_index_ < length_) {
if (dominated_index_ == length_ - 1) { HBasicBlock* block = block_->dominated_blocks()->at(dominated_index_);
// No need to copy the map for the last child in the dominator tree. if (block->IsReachable()) {
Initialize(block_->dominated_blocks()->at(dominated_index_), if (dominated_index_ == length_ - 1) {
map(), // No need to copy the map for the last child in the dominator tree.
dominators(), Initialize(block, map(), dominators(), false, zone);
false, return this;
zone); }
return this; return push(zone, block);
} else if (dominated_index_ < length_) { }
return push(zone, block_->dominated_blocks()->at(dominated_index_));
} else {
return NULL;
} }
return NULL;
} }
GvnBasicBlockState* push(Zone* zone, HBasicBlock* block) { GvnBasicBlockState* push(Zone* zone, HBasicBlock* block) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment