Skip to content

Commit 6a83051

Browse files
committed
Revert llvm#95218 and fix the build
Fix the build failure arising from 76030dc (mlir/Presburger/MPInt: move into llvm/ADT) by reverting the failed fix-forward llvm#95218, and removing the guards on the debug-print functions in DynamicAPInt.
1 parent 638d968 commit 6a83051

File tree

5 files changed

+10
-25
lines changed

5 files changed

+10
-25
lines changed

llvm/include/llvm/ADT/DynamicAPInt.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,14 @@ class DynamicAPInt {
203203

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

206-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
207206
raw_ostream &print(raw_ostream &OS) const;
208207
LLVM_DUMP_METHOD void dump() const;
209-
#endif
210208
};
211209

212-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
213210
inline raw_ostream &operator<<(raw_ostream &OS, const DynamicAPInt &X) {
214211
X.print(OS);
215212
return OS;
216213
}
217-
#endif
218214

219215
/// Redeclarations of friend declaration above to
220216
/// make it discoverable by lookups.

llvm/include/llvm/ADT/SlowDynamicAPInt.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,14 @@ class SlowDynamicAPInt {
7171

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

74-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
7574
void print(raw_ostream &OS) const;
7675
LLVM_DUMP_METHOD void dump() const;
77-
#endif
7876
};
7977

80-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
8178
inline raw_ostream &operator<<(raw_ostream &OS, const SlowDynamicAPInt &X) {
8279
X.print(OS);
8380
return OS;
8481
}
85-
#endif
8682

8783
/// Returns the remainder of dividing LHS by RHS.
8884
///

llvm/lib/Support/DynamicAPInt.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@ hash_code llvm::hash_value(const DynamicAPInt &X) {
1818
return detail::hash_value(X.getLarge());
1919
}
2020

21-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
2221
raw_ostream &DynamicAPInt::print(raw_ostream &OS) const {
2322
if (isSmall())
2423
return OS << ValSmall;
2524
return OS << ValLarge;
2625
}
2726

2827
void DynamicAPInt::dump() const { print(dbgs()); }
29-
#endif

llvm/lib/Support/SlowDynamicAPInt.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,6 @@ SlowDynamicAPInt &SlowDynamicAPInt::operator--() {
281281
/// ---------------------------------------------------------------------------
282282
/// Printing.
283283
/// ---------------------------------------------------------------------------
284-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
285284
void SlowDynamicAPInt::print(raw_ostream &OS) const { OS << Val; }
286285

287286
void SlowDynamicAPInt::dump() const { print(dbgs()); }
288-
#endif

mlir/include/mlir/Analysis/Presburger/Fraction.h

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,14 @@ struct Fraction {
5252
return num / den;
5353
}
5454

55-
/// The numerator and denominator, respectively. The denominator is always
56-
/// positive.
57-
DynamicAPInt num{0}, den{1};
58-
59-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
6055
llvm::raw_ostream &print(llvm::raw_ostream &os) const {
6156
return os << "(" << num << "/" << den << ")";
6257
}
63-
#endif
64-
};
6558

66-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
67-
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Fraction &x) {
68-
x.print(os);
69-
return os;
70-
}
71-
#endif
59+
/// The numerator and denominator, respectively. The denominator is always
60+
/// positive.
61+
DynamicAPInt num{0}, den{1};
62+
};
7263

7364
/// Three-way comparison between two fractions.
7465
/// Returns +1, 0, and -1 if the first fraction is greater than, equal to, or
@@ -165,6 +156,12 @@ inline Fraction &operator*=(Fraction &x, const Fraction &y) {
165156
x = x * y;
166157
return x;
167158
}
159+
160+
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Fraction &x) {
161+
x.print(os);
162+
return os;
163+
}
164+
168165
} // namespace presburger
169166
} // namespace mlir
170167

0 commit comments

Comments
 (0)