[llvm] cfc8769 - [TableGen] Make sure ResNo is the same in CheckTypeMatcher::isContradictoryImpl. (#177312)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 21 23:09:53 PST 2026


Author: Craig Topper
Date: 2026-01-21T23:09:48-08:00
New Revision: cfc876998e06a0916338c3d286c5b169c9d78274

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

LOG: [TableGen] Make sure ResNo is the same in CheckTypeMatcher::isContradictoryImpl. (#177312)

CheckType can only be contradictory if the same result is being checked.

Noticed while looking at the code. This doesn't affect the output on any
in tree targets.

Added: 
    

Modified: 
    llvm/utils/TableGen/DAGISelMatcher.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/DAGISelMatcher.cpp b/llvm/utils/TableGen/DAGISelMatcher.cpp
index c4e4adbc400d3..0178998ab1ae2 100644
--- a/llvm/utils/TableGen/DAGISelMatcher.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcher.cpp
@@ -378,8 +378,14 @@ bool CheckOpcodeMatcher::isContradictoryImpl(const Matcher *M) const {
 }
 
 bool CheckTypeMatcher::isContradictoryImpl(const Matcher *M) const {
-  if (const CheckTypeMatcher *CT = dyn_cast<CheckTypeMatcher>(M))
+  if (const CheckTypeMatcher *CT = dyn_cast<CheckTypeMatcher>(M)) {
+    // If the two checks are about 
diff erent results, we don't know if they
+    // conflict!
+    if (getResNo() != CT->getResNo())
+      return false;
+
     return TypesAreContradictory(getType(), CT->getType());
+  }
   return false;
 }
 


        


More information about the llvm-commits mailing list