[llvm] r315858 - [TableGen] Remove error checks incorrectly failing on non-error conditions

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 15 08:39:56 PDT 2017


Author: kparzysz
Date: Sun Oct 15 08:39:56 2017
New Revision: 315858

URL: http://llvm.org/viewvc/llvm-project?rev=315858&view=rev
Log:
[TableGen] Remove error checks incorrectly failing on non-error conditions

In type inference, an empty type set for a specific hw mode is not an
error. In earlier stages of the design it was, but having to use non-
parameterized types with target intrinsics necessarily led to type
contradictions: since the intrinsics used specific types, they were
only valid for a specific hw mode, and the resulting type set for other
modes ended up empty. To accommodate the existence of such intrinsics
individual type sets were allowed to be empty as long as not all sets
were empty.

Modified:
    llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp

Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=315858&r1=315857&r2=315858&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Sun Oct 15 08:39:56 2017
@@ -514,48 +514,26 @@ bool TypeInfer::EnforceSmallerThan(TypeS
     // MinS = min scalar in Small, remove all scalars from Big that are
     // smaller-or-equal than MinS.
     auto MinS = min_if(S.begin(), S.end(), isScalar, LT);
-    if (MinS != S.end()) {
+    if (MinS != S.end())
       Changed |= berase_if(B, std::bind(LE, std::placeholders::_1, *MinS));
-      if (B.empty()) {
-        TP.error("Type contradiction in " +
-                 Twine(__func__) + ":" + Twine(__LINE__));
-        return Changed;
-      }
-    }
+
     // MaxS = max scalar in Big, remove all scalars from Small that are
     // larger than MaxS.
     auto MaxS = max_if(B.begin(), B.end(), isScalar, LT);
-    if (MaxS != B.end()) {
+    if (MaxS != B.end())
       Changed |= berase_if(S, std::bind(LE, *MaxS, std::placeholders::_1));
-      if (B.empty()) {
-        TP.error("Type contradiction in " +
-                 Twine(__func__) + ":" + Twine(__LINE__));
-        return Changed;
-      }
-    }
 
     // MinV = min vector in Small, remove all vectors from Big that are
     // smaller-or-equal than MinV.
     auto MinV = min_if(S.begin(), S.end(), isVector, LT);
-    if (MinV != S.end()) {
+    if (MinV != S.end())
       Changed |= berase_if(B, std::bind(LE, std::placeholders::_1, *MinV));
-      if (B.empty()) {
-        TP.error("Type contradiction in " +
-                 Twine(__func__) + ":" + Twine(__LINE__));
-        return Changed;
-      }
-    }
+
     // MaxV = max vector in Big, remove all vectors from Small that are
     // larger than MaxV.
     auto MaxV = max_if(B.begin(), B.end(), isVector, LT);
-    if (MaxV != B.end()) {
+    if (MaxV != B.end())
       Changed |= berase_if(S, std::bind(LE, *MaxV, std::placeholders::_1));
-      if (B.empty()) {
-        TP.error("Type contradiction in " +
-                 Twine(__func__) + ":" + Twine(__LINE__));
-        return Changed;
-      }
-    }
   }
 
   return Changed;
@@ -600,12 +578,6 @@ bool TypeInfer::EnforceVectorEltTypeIs(T
     // Remove from E all (scalar) types, for which there is no corresponding
     // type in V.
     Changed |= berase_if(E, [&VT](MVT T) -> bool { return !VT.count(T); });
-
-    if (V.empty() || E.empty()) {
-      TP.error("Type contradiction in " +
-               Twine(__func__) + ":" + Twine(__LINE__));
-      return Changed;
-    }
   }
 
   return Changed;
@@ -666,27 +638,12 @@ bool TypeInfer::EnforceVectorSubVectorTy
     TypeSetByHwMode::SetType &V = Vec.get(M);
 
     Changed |= berase_if(S, isScalar);
-    if (S.empty()) {
-      TP.error("Type contradiction in " +
-               Twine(__func__) + ":" + Twine(__LINE__));
-      return Changed;
-    }
 
     // Erase all types from S that are not sub-vectors of a type in V.
     Changed |= berase_if(S, std::bind(NoSubV, V, std::placeholders::_1));
-    if (S.empty()) {
-      TP.error("Type contradiction in " +
-               Twine(__func__) + ":" + Twine(__LINE__));
-      return Changed;
-    }
 
     // Erase all types from V that are not super-vectors of a type in S.
     Changed |= berase_if(V, std::bind(NoSupV, S, std::placeholders::_1));
-    if (V.empty()) {
-      TP.error("Type contradiction in " +
-               Twine(__func__) + ":" + Twine(__LINE__));
-      return Changed;
-    }
   }
 
   return Changed;




More information about the llvm-commits mailing list