[Mlir-commits] [mlir] [mlir][Quasipolynomials] Fixed type issues in GeneratorFuunction.h (PR #76413)

Balaji V. Iyer. llvmlistbot at llvm.org
Tue Dec 26 14:22:42 PST 2023


https://github.com/bviyer created https://github.com/llvm/llvm-project/pull/76413

Fixed two issues: A SmallVector size that caused size-differences issue (8 vs. 12). Thus removed this size restriction. Also a constant parameter was causing an issue in a function not marked constant.

>From 123627e3be1c0f5676d3f20703be6c7786bfcb77 Mon Sep 17 00:00:00 2001
From: "Balaji V. Iyer" <bviyer at gmail.com>
Date: Tue, 26 Dec 2023 16:17:18 -0600
Subject: [PATCH] [mlir][Quasipolynomials] Fixed type issues in
 GeneratorFuunction.h

Fixed two issues: A SmallVector size that caused size-differences issue
(8 vs. 12). Thus removed this size restriction. Also a constant parameter
was causing an issue in a function not marked constant.
---
 mlir/lib/Analysis/Presburger/GeneratingFunction.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mlir/lib/Analysis/Presburger/GeneratingFunction.h b/mlir/lib/Analysis/Presburger/GeneratingFunction.h
index 8676b84c1c4df8..dad9594f960d1b 100644
--- a/mlir/lib/Analysis/Presburger/GeneratingFunction.h
+++ b/mlir/lib/Analysis/Presburger/GeneratingFunction.h
@@ -49,7 +49,7 @@ using Point = SmallVector<Fraction>;
 // g_{ij} \in Q^n are vectors.
 class GeneratingFunction {
 public:
-  GeneratingFunction(unsigned numParam, SmallVector<int, 8> signs,
+  GeneratingFunction(unsigned numParam, SmallVector<int> signs,
                      std::vector<ParamPoint> nums,
                      std::vector<std::vector<Point>> dens)
       : numParam(numParam), signs(signs), numerators(nums), denominators(dens) {
@@ -67,7 +67,7 @@ class GeneratingFunction {
 
   std::vector<std::vector<Point>> getDenominators() { return denominators; }
 
-  GeneratingFunction operator+(const GeneratingFunction &gf) const {
+  GeneratingFunction operator+(GeneratingFunction &gf) const {
     assert(numParam == gf.getNumParams() &&
            "two generating functions with different numbers of parameters "
            "cannot be added!");
@@ -81,7 +81,7 @@ class GeneratingFunction {
     std::vector<std::vector<Point>> sumDenominators = denominators;
     sumDenominators.insert(sumDenominators.end(), gf.denominators.begin(),
                            gf.denominators.end());
-    return GeneratingFunction(sumSigns, sumNumerators, sumDenominators);
+    return GeneratingFunction(0, sumSigns, sumNumerators, sumDenominators);
   }
 
   llvm::raw_ostream &print(llvm::raw_ostream &os) const {
@@ -121,7 +121,7 @@ class GeneratingFunction {
 
 private:
   unsigned numParam;
-  SmallVector<int, 8> signs;
+  SmallVector<int> signs;
   std::vector<ParamPoint> numerators;
   std::vector<std::vector<Point>> denominators;
 };
@@ -129,4 +129,4 @@ class GeneratingFunction {
 } // namespace presburger
 } // namespace mlir
 
-#endif // MLIR_ANALYSIS_PRESBURGER_GENERATINGFUNCTION_H
\ No newline at end of file
+#endif // MLIR_ANALYSIS_PRESBURGER_GENERATINGFUNCTION_H



More information about the Mlir-commits mailing list