[TableGen] Make CheckImmAllOnesVMatcher and CheckImmAllZerosVMatcher contradictory...
authorCraig Topper <craig.topper@intel.com>
Sun, 10 Mar 2019 06:44:09 +0000 (06:44 +0000)
committerCraig Topper <craig.topper@intel.com>
Sun, 10 Mar 2019 06:44:09 +0000 (06:44 +0000)
This improves X86 factoring a little bit.

llvm-svn: 355785

llvm/utils/TableGen/DAGISelMatcher.cpp
llvm/utils/TableGen/DAGISelMatcher.h

index 0c45ff1..b2d819c 100644 (file)
@@ -412,3 +412,16 @@ bool CheckValueTypeMatcher::isContradictoryImpl(const Matcher *M) const {
   return false;
 }
 
+bool CheckImmAllOnesVMatcher::isContradictoryImpl(const Matcher *M) const {
+  // AllZeros is contradictory.
+  if (const auto *CIAZVM = dyn_cast<CheckImmAllZerosVMatcher>(M))
+    return true;
+  return false;
+}
+
+bool CheckImmAllZerosVMatcher::isContradictoryImpl(const Matcher *M) const {
+  // AllOnes is contradictory.
+  if (const auto *CIAOVM = dyn_cast<CheckImmAllOnesVMatcher>(M))
+    return true;
+  return false;
+}
index 24932e6..0a782e8 100644 (file)
@@ -770,6 +770,7 @@ public:
 private:
   void printImpl(raw_ostream &OS, unsigned indent) const override;
   bool isEqualImpl(const Matcher *M) const override { return true; }
+  bool isContradictoryImpl(const Matcher *M) const override;
 };
 
 /// CheckImmAllZerosVMatcher - This check if the current node is an build vector
@@ -785,6 +786,7 @@ public:
 private:
   void printImpl(raw_ostream &OS, unsigned indent) const override;
   bool isEqualImpl(const Matcher *M) const override { return true; }
+  bool isContradictoryImpl(const Matcher *M) const override;
 };
 
 /// CheckFoldableChainNodeMatcher - This checks to see if the current node