[llvm] 31bd82c - [TableGen] Don't try to move CheckOpcode before CheckType/CheckChildType in ContractNodes. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 21:38:15 PST 2025


Author: Craig Topper
Date: 2025-02-04T21:17:20-08:00
New Revision: 31bd82cdcc37df0ce19c6cf771d89a2afb80fa89

URL: https://github.com/llvm/llvm-project/commit/31bd82cdcc37df0ce19c6cf771d89a2afb80fa89
DIFF: https://github.com/llvm/llvm-project/commit/31bd82cdcc37df0ce19c6cf771d89a2afb80fa89.diff

LOG: [TableGen] Don't try to move CheckOpcode before CheckType/CheckChildType in ContractNodes. NFC

It appears that CheckOpcode is already emitted before CheckType so
this hasn't been doing anything on any in tree targets.

Added: 
    

Modified: 
    llvm/utils/TableGen/DAGISelMatcherOpt.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
index 1092b33ec94feec..713092c431b07d5 100644
--- a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
@@ -135,13 +135,11 @@ static void ContractNodes(std::unique_ptr<Matcher> &MatcherPtr,
       // variants.
     }
 
-  // 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
-  // like X86 where many operations are valid on multiple types.
-  if ((isa<CheckTypeMatcher>(N) || isa<CheckChildTypeMatcher>(N) ||
-       isa<RecordMatcher>(N)) &&
-      isa<CheckOpcodeMatcher>(N->getNext())) {
+  // If we have a 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 like X86 where many operations are
+  // valid on multiple types.
+  if (isa<RecordMatcher>(N) && isa<CheckOpcodeMatcher>(N->getNext())) {
     // Unlink the two nodes from the list.
     Matcher *CheckType = MatcherPtr.release();
     Matcher *CheckOpcode = CheckType->takeNext();


        


More information about the llvm-commits mailing list