Bug 1058090 - IonMonkey: Minor compile-time speedups r=luke

This commit is contained in:
Dan Gohman 2014-09-18 08:51:35 -07:00
parent a0abc413a0
commit 29d65ea0c5
3 changed files with 19 additions and 1 deletions

View File

@ -27,7 +27,9 @@ LoopContainsPossibleCall(MIRGraph &graph, MBasicBlock *header, MBasicBlock *back
for (auto insIter(block->begin()), insEnd(block->end()); insIter != insEnd; ++insIter) {
MInstruction *ins = *insIter;
if (ins->possiblyCalls()) {
#ifdef DEBUG
JitSpew(JitSpew_LICM, " Possile call found at %s%u", ins->opName(), ins->id());
#endif
return true;
}
}
@ -152,8 +154,10 @@ MoveDeferredOperands(MInstruction *ins, MInstruction *hoistPoint, bool hasCalls)
// because we require RequiresHoistedUse to be set at each level.
MoveDeferredOperands(opIns, hoistPoint, hasCalls);
#ifdef DEBUG
JitSpew(JitSpew_LICM, " Hoisting %s%u (now that a user will be hoisted)",
opIns->opName(), opIns->id());
#endif
opIns->block()->moveBefore(hoistPoint, opIns);
}
@ -180,15 +184,19 @@ VisitLoopBlock(MBasicBlock *block, MBasicBlock *header, MInstruction *hoistPoint
// its uses. We want those instructions as close as possible to their
// use, to minimize register pressure.
if (RequiresHoistedUse(ins, hasCalls)) {
#ifdef DEBUG
JitSpew(JitSpew_LICM, " %s%u will be hoisted only if its users are",
ins->opName(), ins->id());
#endif
continue;
}
// Hoist operands which were too cheap to hoist on their own.
MoveDeferredOperands(ins, hoistPoint, hasCalls);
#ifdef DEBUG
JitSpew(JitSpew_LICM, " Hoisting %s%u", ins->opName(), ins->id());
#endif
// Move the instruction to the hoistPoint.
block->moveBefore(hoistPoint, ins);
@ -200,8 +208,10 @@ VisitLoop(MIRGraph &graph, MBasicBlock *header)
{
MInstruction *hoistPoint = header->loopPredecessor()->lastIns();
#ifdef DEBUG
JitSpew(JitSpew_LICM, " Visiting loop with header block%u, hoisting to %s%u",
header->id(), hoistPoint->opName(), hoistPoint->id());
#endif
MBasicBlock *backedge = header->backedge();

View File

@ -163,7 +163,9 @@ LoopUnroller::go(LoopIterationBound *bound)
continue;
if (ins->isTest() || ins->isGoto() || ins->isInterruptCheck())
continue;
#ifdef DEBUG
JitSpew(JitSpew_Unrolling, "Aborting: can't clone instruction %s", ins->opName());
#endif
return;
}
}

View File

@ -345,11 +345,11 @@ ValueNumberer::releaseOperands(MDefinition *def)
bool
ValueNumberer::discardDef(MDefinition *def)
{
#ifdef DEBUG
JitSpew(JitSpew_GVN, " Discarding %s %s%u",
def->block()->isMarked() ? "unreachable" : "dead",
def->opName(), def->id());
#ifdef DEBUG
MOZ_ASSERT(def != nextDef_, "Invalidating the MDefinition iterator");
if (def->block()->isMarked()) {
MOZ_ASSERT(!def->hasUses(), "Discarding def that still has uses");
@ -723,8 +723,10 @@ ValueNumberer::visitDefinition(MDefinition *def)
if (sim->block() == nullptr)
def->block()->insertAfter(def->toInstruction(), sim->toInstruction());
#ifdef DEBUG
JitSpew(JitSpew_GVN, " Folded %s%u to %s%u",
def->opName(), def->id(), sim->opName(), sim->id());
#endif
ReplaceAllUsesWith(def, sim);
// The node's foldsTo said |def| can be replaced by |rep|. If |def| is a
@ -745,9 +747,11 @@ ValueNumberer::visitDefinition(MDefinition *def)
if (rep == nullptr)
return false;
if (rep->updateForReplacement(def)) {
#ifdef DEBUG
JitSpew(JitSpew_GVN,
" Replacing %s%u with %s%u",
def->opName(), def->id(), rep->opName(), rep->id());
#endif
ReplaceAllUsesWith(def, rep);
// The node's congruentTo said |def| is congruent to |rep|, and it's
@ -787,8 +791,10 @@ ValueNumberer::visitControlInstruction(MBasicBlock *block, const MBasicBlock *do
MControlInstruction *newControl = rep->toControlInstruction();
MOZ_ASSERT(!newControl->block(),
"Control instruction replacement shouldn't already be in a block");
#ifdef DEBUG
JitSpew(JitSpew_GVN, " Folded control instruction %s%u to %s%u",
control->opName(), control->id(), newControl->opName(), graph_.getNumInstructionIds());
#endif
// If the simplification removes any CFG edges, update the CFG and remove
// any blocks that become dead.