diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc index ce31710dcca..d3258f98b9d 100644 --- a/runtime/vm/flow_graph_compiler.cc +++ b/runtime/vm/flow_graph_compiler.cc @@ -225,9 +225,9 @@ bool FlowGraphCompiler::ForceSlowPathForStackOverflow() const { static bool IsEmptyBlock(BlockEntryInstr* block) { - return !block->HasParallelMove() && + return !block->HasNonRedundantParallelMove() && block->next()->IsGoto() && - !block->next()->AsGoto()->HasParallelMove(); + !block->next()->AsGoto()->HasNonRedundantParallelMove(); } diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc index ce6092afed4..c9c196855c5 100644 --- a/runtime/vm/intermediate_language.cc +++ b/runtime/vm/intermediate_language.cc @@ -2566,6 +2566,16 @@ void ParameterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { } +bool ParallelMoveInstr::IsRedundant() const { + for (intptr_t i = 0; i < moves_.length(); i++) { + if (!moves_[i]->IsRedundant()) { + return false; + } + } + return true; +} + + LocationSummary* ParallelMoveInstr::MakeLocationSummary(Isolate* isolate, bool optimizing) const { return NULL; diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h index 923b88334b8..2f46de57edc 100644 --- a/runtime/vm/intermediate_language.h +++ b/runtime/vm/intermediate_language.h @@ -1078,6 +1078,8 @@ class ParallelMoveInstr : public TemplateInstruction<0> { intptr_t NumMoves() const { return moves_.length(); } + bool IsRedundant() const; + virtual void PrintTo(BufferFormatter* f) const; virtual bool MayThrow() const { return false; } @@ -1138,6 +1140,10 @@ class BlockEntryInstr : public Instruction { return parallel_move_ != NULL; } + bool HasNonRedundantParallelMove() const { + return HasParallelMove() && !parallel_move()->IsRedundant(); + } + ParallelMoveInstr* GetParallelMove() { if (parallel_move_ == NULL) { parallel_move_ = new ParallelMoveInstr(); @@ -2167,6 +2173,10 @@ class GotoInstr : public TemplateInstruction<0> { return parallel_move_ != NULL; } + bool HasNonRedundantParallelMove() const { + return HasParallelMove() && !parallel_move()->IsRedundant(); + } + ParallelMoveInstr* GetParallelMove() { if (parallel_move_ == NULL) { parallel_move_ = new ParallelMoveInstr();