[Mlir-commits] [mlir] 094ad06 - [MLIR][Presburger] change some `push_back`s to `emplace_back`s

Arjun P llvmlistbot at llvm.org
Wed Apr 13 20:32:05 PDT 2022


Author: Arjun P
Date: 2022-04-14T04:27:21+01:00
New Revision: 094ad0667c5eb61817b68a65a89201310157e57d

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

LOG: [MLIR][Presburger] change some `push_back`s to `emplace_back`s

Added: 
    

Modified: 
    mlir/lib/Analysis/Presburger/PWMAFunction.cpp
    mlir/lib/Analysis/Presburger/Simplex.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Analysis/Presburger/PWMAFunction.cpp b/mlir/lib/Analysis/Presburger/PWMAFunction.cpp
index c7906a43c90e6..851099e303e2a 100644
--- a/mlir/lib/Analysis/Presburger/PWMAFunction.cpp
+++ b/mlir/lib/Analysis/Presburger/PWMAFunction.cpp
@@ -55,7 +55,7 @@ MultiAffineFunction::valueAt(ArrayRef<int64_t> point) const {
   // of the matrix contains the constant term. Let v be the input point with
   // a 1 appended at the end. We can see that output * v gives the desired
   // output vector.
-  pointHomogenous.push_back(1);
+  pointHomogenous.emplace_back(1);
   SmallVector<int64_t, 8> result =
       output.postMultiplyWithColumn(pointHomogenous);
   assert(result.size() == getNumOutputs());

diff  --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp
index 8fd789a74b840..c84b761d96fec 100644
--- a/mlir/lib/Analysis/Presburger/Simplex.cpp
+++ b/mlir/lib/Analysis/Presburger/Simplex.cpp
@@ -1691,7 +1691,7 @@ class presburger::GBRSimplex {
       else if (simplex.con[i + 1].orientation == Orientation::Column)
         dual.push_back(simplex.tableau(row, simplex.con[i + 1].pos));
       else
-        dual.push_back(0);
+        dual.emplace_back(0);
     }
     return *maybeWidth;
   }
@@ -1718,7 +1718,7 @@ class presburger::GBRSimplex {
     coeffs.reserve(2 * dir.size());
     for (int64_t coeff : dir)
       coeffs.push_back(-coeff);
-    coeffs.push_back(0); // constant term
+    coeffs.emplace_back(0); // constant term
     return coeffs;
   }
 
@@ -1987,7 +1987,7 @@ Optional<SmallVector<int64_t, 8>> Simplex::findIntegerSample() {
       // generalized basis reduction.
       SmallVector<int64_t, 8> basisCoeffs =
           llvm::to_vector<8>(basis.getRow(level));
-      basisCoeffs.push_back(0);
+      basisCoeffs.emplace_back(0);
 
       MaybeOptimum<int64_t> minRoundedUp, maxRoundedDown;
       std::tie(minRoundedUp, maxRoundedDown) =
@@ -2017,7 +2017,7 @@ Optional<SmallVector<int64_t, 8>> Simplex::findIntegerSample() {
       if (*minRoundedUp < *maxRoundedDown) {
         reduceBasis(basis, level);
         basisCoeffs = llvm::to_vector<8>(basis.getRow(level));
-        basisCoeffs.push_back(0);
+        basisCoeffs.emplace_back(0);
         std::tie(minRoundedUp, maxRoundedDown) =
             computeIntegerBounds(basisCoeffs);
       }


        


More information about the Mlir-commits mailing list