Skip to content

Commit 2d17fc4

Browse files
committed
[TableGen] Reorder code in ContractNodes to prevents unnecessary recursion. NFC
The code that moves CheckOpcode before CheckType/CheckChildType/RecordDwith was running after ContractNodes started unwinding its recursion. If a move occurs we would start a new recursion going forward through the list again. I don't believe this can lead to any new combines so it was just wasted work. This patch moves the code earlier so it doesn't start a new recursion.
1 parent 7271681 commit 2d17fc4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/utils/TableGen/DAGISelMatcherOpt.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ static void ContractNodes(std::unique_ptr<Matcher> &MatcherPtr,
135135
// variants.
136136
}
137137

138-
ContractNodes(N->getNextPtr(), CGP);
139-
140138
// If we have a CheckType/CheckChildType/Record node followed by a
141139
// CheckOpcode, invert the two nodes. We prefer to do structural checks
142140
// before type checks, as this opens opportunities for factoring on targets
@@ -156,6 +154,8 @@ static void ContractNodes(std::unique_ptr<Matcher> &MatcherPtr,
156154
return ContractNodes(MatcherPtr, CGP);
157155
}
158156

157+
ContractNodes(N->getNextPtr(), CGP);
158+
159159
// If we have a MoveParent followed by a MoveChild, we convert it to
160160
// MoveSibling.
161161
if (auto *MP = dyn_cast<MoveParentMatcher>(N)) {

0 commit comments

Comments
 (0)