[ConstraintSystem] Pass ArrayRef instead of full small vector (NFC).
authorFlorian Hahn <flo@fhahn.com>
Wed, 16 Feb 2022 14:35:46 +0000 (14:35 +0000)
committerFlorian Hahn <flo@fhahn.com>
Fri, 18 Feb 2022 14:03:09 +0000 (14:03 +0000)
This makes the called functions independent of the container type.

llvm/include/llvm/Analysis/ConstraintSystem.h

index 2ca1d5c..d0f80c8 100644 (file)
@@ -36,7 +36,7 @@ class ConstraintSystem {
   bool mayHaveSolutionImpl();
 
 public:
-  bool addVariableRow(const SmallVector<int64_t, 8> &R) {
+  bool addVariableRow(ArrayRef<int64_t> R) {
     assert(Constraints.empty() || R.size() == Constraints.back().size());
     // If all variable coefficients are 0, the constraint does not provide any
     // usable information.
@@ -48,11 +48,11 @@ public:
       GCD = APIntOps::GreatestCommonDivisor({32, (uint32_t)A}, {32, GCD})
                 .getZExtValue();
     }
-    Constraints.push_back(R);
+    Constraints.emplace_back(R.begin(), R.end());
     return true;
   }
 
-  bool addVariableRowFill(const SmallVector<int64_t, 8> &R) {
+  bool addVariableRowFill(ArrayRef<int64_t> R) {
     for (auto &CR : Constraints) {
       while (CR.size() != R.size())
         CR.push_back(0);