aboutsummaryrefslogtreecommitdiff
path: root/mlir
diff options
context:
space:
mode:
authorRamkumar Ramachandra <ramkumar.ramachandra@codasip.com>2024-06-12 11:00:25 +0100
committerGitHub <noreply@github.com>2024-06-12 11:00:25 +0100
commit638d96843893f6981c9af8c501f6999cc7db15e6 (patch)
treef053959f9a05d0b7182123687686ea52a5d264ea /mlir
parentcece0a105b29dcbb9d88d0aa264c4745c07a8456 (diff)
downloadllvm-638d96843893f6981c9af8c501f6999cc7db15e6.zip
llvm-638d96843893f6981c9af8c501f6999cc7db15e6.tar.gz
llvm-638d96843893f6981c9af8c501f6999cc7db15e6.tar.bz2
mlir/Presburger: guard dump function; fix buildbot (#95218)
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.
Diffstat (limited to 'mlir')
-rw-r--r--mlir/include/mlir/Analysis/Presburger/Fraction.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/mlir/include/mlir/Analysis/Presburger/Fraction.h b/mlir/include/mlir/Analysis/Presburger/Fraction.h
index f4f1be9..6be1320 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