[llvm] b467043 - [ConstraintSystem] Pass ArrayRef instead of full small vector (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 18 06:04:23 PST 2022


Author: Florian Hahn
Date: 2022-02-18T14:03:09Z
New Revision: b4670438b3ba37b2d4cca004f9a5275e3ea6365c

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

LOG: [ConstraintSystem] Pass ArrayRef instead of full small vector (NFC).

This makes the called functions independent of the container type.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/ConstraintSystem.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/ConstraintSystem.h b/llvm/include/llvm/Analysis/ConstraintSystem.h
index 2ca1d5ca78a7e..d0f80c87e03b7 100644
--- a/llvm/include/llvm/Analysis/ConstraintSystem.h
+++ b/llvm/include/llvm/Analysis/ConstraintSystem.h
@@ -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 @@ class ConstraintSystem {
       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);


        


More information about the llvm-commits mailing list