Bug 1029830 - IonMonkey: GVN: Now that there are foldsTo functions using dependency information, clear it when it becomes invalid r=nbp

This commit is contained in:
Dan Gohman 2014-09-17 10:27:24 -07:00
parent 0f6c117812
commit 7d8db9d4b5

View File

@ -468,6 +468,21 @@ ValueNumberer::loopHasOptimizablePhi(MBasicBlock *backedge) const
bool
ValueNumberer::visitDefinition(MDefinition *def)
{
// If this instruction has a dependency() into an unreachable block, we'll
// need to update AliasAnalysis.
const MDefinition *dep = def->dependency();
if (dep != nullptr && dep->block()->isDead()) {
JitSpew(JitSpew_GVN, " AliasAnalysis invalidated");
if (updateAliasAnalysis_ && !dependenciesBroken_) {
// TODO: Recomputing alias-analysis could theoretically expose more
// GVN opportunities.
JitSpew(JitSpew_GVN, " Will recompute!");
dependenciesBroken_ = true;
}
// Clear its dependency for now, to protect foldsTo.
def->setDependency(def->toInstruction());
}
// Look for a simplified form of |def|.
MDefinition *sim = simplified(def);
if (sim != def) {
@ -523,16 +538,6 @@ ValueNumberer::visitDefinition(MDefinition *def)
}
}
// If this instruction has a dependency() into an unreachable block, we'll
// need to update AliasAnalysis.
if (updateAliasAnalysis_ && !dependenciesBroken_) {
const MDefinition *dep = def->dependency();
if (dep != nullptr && dep->block()->isDead()) {
JitSpew(JitSpew_GVN, " AliasAnalysis invalidated; will recompute!");
dependenciesBroken_ = true;
}
}
return true;
}