[llvm] 2d17fc4 - [TableGen] Reorder code in ContractNodes to prevents unnecessary recursion. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 31 23:47:41 PST 2025
Author: Craig Topper
Date: 2025-01-31T23:45:40-08:00
New Revision: 2d17fc4ca31dcc8fdc5df0c554d548e348a5ee0b
URL: https://github.com/llvm/llvm-project/commit/2d17fc4ca31dcc8fdc5df0c554d548e348a5ee0b
DIFF: https://github.com/llvm/llvm-project/commit/2d17fc4ca31dcc8fdc5df0c554d548e348a5ee0b.diff
LOG: [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.
Added:
Modified:
llvm/utils/TableGen/DAGISelMatcherOpt.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
index 66487caa61838f..e2a9d9a7f14178 100644
--- a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
@@ -135,8 +135,6 @@ static void ContractNodes(std::unique_ptr<Matcher> &MatcherPtr,
// variants.
}
- ContractNodes(N->getNextPtr(), CGP);
-
// If we have a CheckType/CheckChildType/Record node followed by a
// CheckOpcode, invert the two nodes. We prefer to do structural checks
// before type checks, as this opens opportunities for factoring on targets
@@ -156,6 +154,8 @@ static void ContractNodes(std::unique_ptr<Matcher> &MatcherPtr,
return ContractNodes(MatcherPtr, CGP);
}
+ ContractNodes(N->getNextPtr(), CGP);
+
// If we have a MoveParent followed by a MoveChild, we convert it to
// MoveSibling.
if (auto *MP = dyn_cast<MoveParentMatcher>(N)) {
More information about the llvm-commits
mailing list