[Mlir-commits] [mlir] mlir/Presburger: guard dump function; fix buildbot (PR #95218)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jun 12 02:57:44 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-presburger

Author: Ramkumar Ramachandra (artagnon)

<details>
<summary>Changes</summary>

Follow up on 76030dc (mlir/Presburger/MPInt: move into llvm/ADT) to guard a function in Fraction.h with !NDEBUG || LLVM_ENABLE_DUMP, since the call to the corresponding function in DynamicAPInt is guarded similarly. This patch fixes the build when mlir is built with this configuration.

---
Full diff: https://github.com/llvm/llvm-project/pull/95218.diff


1 Files Affected:

- (modified) mlir/include/mlir/Analysis/Presburger/Fraction.h (+13-10) 


``````````diff
diff --git a/mlir/include/mlir/Analysis/Presburger/Fraction.h b/mlir/include/mlir/Analysis/Presburger/Fraction.h
index f4f1be97147bf..6be132058e6ca 100644
--- a/mlir/include/mlir/Analysis/Presburger/Fraction.h
+++ b/mlir/include/mlir/Analysis/Presburger/Fraction.h
@@ -52,15 +52,24 @@ struct Fraction {
     return num / den;
   }
 
-  llvm::raw_ostream &print(llvm::raw_ostream &os) const {
-    return os << "(" << num << "/" << den << ")";
-  }
-
   /// The numerator and denominator, respectively. The denominator is always
   /// positive.
   DynamicAPInt num{0}, den{1};
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+  llvm::raw_ostream &print(llvm::raw_ostream &os) const {
+    return os << "(" << num << "/" << den << ")";
+  }
+#endif
 };
 
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Fraction &x) {
+  x.print(os);
+  return os;
+}
+#endif
+
 /// Three-way comparison between two fractions.
 /// Returns +1, 0, and -1 if the first fraction is greater than, equal to, or
 /// less than the second fraction, respectively.
@@ -156,12 +165,6 @@ inline Fraction &operator*=(Fraction &x, const Fraction &y) {
   x = x * y;
   return x;
 }
-
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Fraction &x) {
-  x.print(os);
-  return os;
-}
-
 } // namespace presburger
 } // namespace mlir
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/95218


More information about the Mlir-commits mailing list