Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlir/Presburger: guard dump function; fix buildbot #95218

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions mlir/include/mlir/Analysis/Presburger/Fraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down
Loading