pull MarkFlagResult out from between an EmitNode/CompleteMatch

pair.  This encourages MorphNodeTo formation, this gets us 200
more MorphNodeTo's on X86 and shrinks the table a bit.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97434 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-03-01 02:33:14 +00:00
parent 0cebe6181a
commit c99b5a25bb

View File

@ -67,7 +67,23 @@ static void ContractNodes(OwningPtr<Matcher> &MatcherPtr,
return ContractNodes(MatcherPtr, CGP); return ContractNodes(MatcherPtr, CGP);
} }
// FIXME: Handle OPC_MarkFlagResults. // Turn EmitNode->MarkFlagResults->CompleteMatch into
// MarkFlagResults->EmitNode->CompleteMatch when we can to encourage
// MorphNodeTo formation. This is safe because MarkFlagResults never refers
// to the root of the pattern.
if (isa<EmitNodeMatcher>(N) && isa<MarkFlagResultsMatcher>(N->getNext()) &&
isa<CompleteMatchMatcher>(N->getNext()->getNext())) {
// Unlink the two nodes from the list.
Matcher *EmitNode = MatcherPtr.take();
Matcher *MFR = EmitNode->takeNext();
Matcher *Tail = MFR->takeNext();
// Relink them.
MatcherPtr.reset(MFR);
MFR->setNext(EmitNode);
EmitNode->setNext(Tail);
return ContractNodes(MatcherPtr, CGP);
}
// Turn EmitNode->CompleteMatch into MorphNodeTo if we can. // Turn EmitNode->CompleteMatch into MorphNodeTo if we can.
if (EmitNodeMatcher *EN = dyn_cast<EmitNodeMatcher>(N)) if (EmitNodeMatcher *EN = dyn_cast<EmitNodeMatcher>(N))