Skip to content

Commit ef49c92

Browse files
authored
[NFC][LLVM] Namespace cleanup in ScalarEvolution (#166620)
1 parent 5e5937c commit ef49c92

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13998,7 +13998,15 @@ static void PrintLoopInfo(raw_ostream &OS, ScalarEvolution *SE,
1399813998
}
1399913999

1400014000
namespace llvm {
14001-
raw_ostream &operator<<(raw_ostream &OS, ScalarEvolution::LoopDisposition LD) {
14001+
// Note: these overloaded operators need to be in the llvm namespace for them
14002+
// to be resolved correctly. If we put them outside the llvm namespace, the
14003+
//
14004+
// OS << ": " << SE.getLoopDisposition(SV, InnerL);
14005+
//
14006+
// code below "breaks" and start printing raw enum values as opposed to the
14007+
// string values.
14008+
static raw_ostream &operator<<(raw_ostream &OS,
14009+
ScalarEvolution::LoopDisposition LD) {
1400214010
switch (LD) {
1400314011
case ScalarEvolution::LoopVariant:
1400414012
OS << "Variant";
@@ -14013,7 +14021,8 @@ raw_ostream &operator<<(raw_ostream &OS, ScalarEvolution::LoopDisposition LD) {
1401314021
return OS;
1401414022
}
1401514023

14016-
raw_ostream &operator<<(raw_ostream &OS, ScalarEvolution::BlockDisposition BD) {
14024+
static raw_ostream &operator<<(raw_ostream &OS,
14025+
llvm::ScalarEvolution::BlockDisposition BD) {
1401714026
switch (BD) {
1401814027
case ScalarEvolution::DoesNotDominateBlock:
1401914028
OS << "DoesNotDominate";

llvm/lib/Analysis/ScalarEvolutionDivision.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ class Type;
2929

3030
using namespace llvm;
3131

32-
namespace {
33-
3432
static inline int sizeOfSCEV(const SCEV *S) {
3533
struct FindSCEVSize {
3634
int Size = 0;
@@ -52,8 +50,6 @@ static inline int sizeOfSCEV(const SCEV *S) {
5250
return F.Size;
5351
}
5452

55-
} // namespace
56-
5753
// Computes the Quotient and Remainder of the division of Numerator by
5854
// Denominator.
5955
void SCEVDivision::divide(ScalarEvolution &SE, const SCEV *Numerator,

0 commit comments

Comments
 (0)