Ignore redundant parallel moves when checking if a block is empty.

Single predecessor blocks containing nothing but redundant parallel moves can be compacted away.

R=zerny@google.com
BUG=http://dartbug.com/21302

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41187 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
vegorov@google.com
2014-10-20 11:29:19 +00:00
parent bcf6565dfe
commit dde7963d36
3 changed files with 22 additions and 2 deletions
+2 -2
View File
@@ -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();
}
+10
View File
@@ -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;
+10
View File
@@ -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();