Bug 885180 - Fix isLoopBackedge to work even when critical edges are not split, and tighten up some related assertions. r=bhackett

This commit is contained in:
Dan Gohman 2013-06-20 12:28:55 -07:00
parent 55f818af94
commit 2782f3429e

View File

@ -311,9 +311,13 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
bool isLoopHeader() const {
return kind_ == LOOP_HEADER;
}
MBasicBlock *backedge() const {
bool hasUniqueBackedge() const {
JS_ASSERT(isLoopHeader());
JS_ASSERT(numPredecessors() == 1 || numPredecessors() == 2);
JS_ASSERT(numPredecessors() >= 2);
return numPredecessors() == 2;
}
MBasicBlock *backedge() const {
JS_ASSERT(hasUniqueBackedge());
return getPredecessor(numPredecessors() - 1);
}
MBasicBlock *loopHeaderOfBackedge() const {
@ -328,7 +332,9 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
if (!numSuccessors())
return false;
MBasicBlock *lastSuccessor = getSuccessor(numSuccessors() - 1);
return lastSuccessor->isLoopHeader() && lastSuccessor->backedge() == this;
return lastSuccessor->isLoopHeader() &&
lastSuccessor->hasUniqueBackedge() &&
lastSuccessor->backedge() == this;
}
bool isSplitEdge() const {
return kind_ == SPLIT_EDGE;