Skip to content

Revert #95218 and fix the build #95252

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
4 changes: 0 additions & 4 deletions llvm/include/llvm/ADT/DynamicAPInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,14 @@ class DynamicAPInt {

friend hash_code hash_value(const DynamicAPInt &x); // NOLINT

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
raw_ostream &print(raw_ostream &OS) const;
LLVM_DUMP_METHOD void dump() const;
#endif
};

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
inline raw_ostream &operator<<(raw_ostream &OS, const DynamicAPInt &X) {
X.print(OS);
return OS;
}
#endif

/// Redeclarations of friend declaration above to
/// make it discoverable by lookups.
Expand Down
4 changes: 0 additions & 4 deletions llvm/include/llvm/ADT/SlowDynamicAPInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,14 @@ class SlowDynamicAPInt {

unsigned getBitWidth() const { return Val.getBitWidth(); }

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void print(raw_ostream &OS) const;
LLVM_DUMP_METHOD void dump() const;
#endif
};

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
inline raw_ostream &operator<<(raw_ostream &OS, const SlowDynamicAPInt &X) {
X.print(OS);
return OS;
}
#endif

/// Returns the remainder of dividing LHS by RHS.
///
Expand Down
2 changes: 0 additions & 2 deletions llvm/lib/Support/DynamicAPInt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ hash_code llvm::hash_value(const DynamicAPInt &X) {
return detail::hash_value(X.getLarge());
}

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
raw_ostream &DynamicAPInt::print(raw_ostream &OS) const {
if (isSmall())
return OS << ValSmall;
return OS << ValLarge;
}

void DynamicAPInt::dump() const { print(dbgs()); }
#endif
2 changes: 0 additions & 2 deletions llvm/lib/Support/SlowDynamicAPInt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,6 @@ SlowDynamicAPInt &SlowDynamicAPInt::operator--() {
/// ---------------------------------------------------------------------------
/// Printing.
/// ---------------------------------------------------------------------------
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void SlowDynamicAPInt::print(raw_ostream &OS) const { OS << Val; }

void SlowDynamicAPInt::dump() const { print(dbgs()); }
#endif
23 changes: 10 additions & 13 deletions mlir/include/mlir/Analysis/Presburger/Fraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,14 @@ struct Fraction {
return 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
/// The numerator and denominator, respectively. The denominator is always
/// positive.
DynamicAPInt num{0}, den{1};
};

/// Three-way comparison between two fractions.
/// Returns +1, 0, and -1 if the first fraction is greater than, equal to, or
Expand Down Expand Up @@ -165,6 +156,12 @@ 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