Skip to content

Commit f3101f3

Browse files
committed
[NFC][LLVM] Cleanup namespace usage in DFAJumpThreading.cpp
1 parent 08e9540 commit f3101f3

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ static cl::opt<unsigned>
121121
cl::Hidden, cl::init(50));
122122

123123
namespace {
124-
125124
class SelectInstToUnfold {
126125
SelectInst *SI;
127126
PHINode *SIUse;
@@ -134,11 +133,14 @@ class SelectInstToUnfold {
134133

135134
explicit operator bool() const { return SI && SIUse; }
136135
};
136+
} // namespace
137137

138-
void unfold(DomTreeUpdater *DTU, LoopInfo *LI, SelectInstToUnfold SIToUnfold,
139-
std::vector<SelectInstToUnfold> *NewSIsToUnfold,
140-
std::vector<BasicBlock *> *NewBBs);
138+
static void unfold(DomTreeUpdater *DTU, LoopInfo *LI,
139+
SelectInstToUnfold SIToUnfold,
140+
std::vector<SelectInstToUnfold> *NewSIsToUnfold,
141+
std::vector<BasicBlock *> *NewBBs);
141142

143+
namespace {
142144
class DFAJumpThreading {
143145
public:
144146
DFAJumpThreading(AssumptionCache *AC, DominatorTree *DT, LoopInfo *LI,
@@ -173,10 +175,7 @@ class DFAJumpThreading {
173175
TargetTransformInfo *TTI;
174176
OptimizationRemarkEmitter *ORE;
175177
};
176-
177-
} // end anonymous namespace
178-
179-
namespace {
178+
} // namespace
180179

181180
/// Unfold the select instruction held in \p SIToUnfold by replacing it with
182181
/// control flow.
@@ -185,9 +184,10 @@ namespace {
185184
/// created basic blocks into \p NewBBs.
186185
///
187186
/// TODO: merge it with CodeGenPrepare::optimizeSelectInst() if possible.
188-
void unfold(DomTreeUpdater *DTU, LoopInfo *LI, SelectInstToUnfold SIToUnfold,
189-
std::vector<SelectInstToUnfold> *NewSIsToUnfold,
190-
std::vector<BasicBlock *> *NewBBs) {
187+
static void unfold(DomTreeUpdater *DTU, LoopInfo *LI,
188+
SelectInstToUnfold SIToUnfold,
189+
std::vector<SelectInstToUnfold> *NewSIsToUnfold,
190+
std::vector<BasicBlock *> *NewBBs) {
191191
SelectInst *SI = SIToUnfold.getInst();
192192
PHINode *SIUse = SIToUnfold.getUse();
193193
assert(SI->hasOneUse());
@@ -342,10 +342,12 @@ void unfold(DomTreeUpdater *DTU, LoopInfo *LI, SelectInstToUnfold SIToUnfold,
342342
SI->eraseFromParent();
343343
}
344344

345+
namespace {
345346
struct ClonedBlock {
346347
BasicBlock *BB;
347348
APInt State; ///< \p State corresponds to the next value of a switch stmnt.
348349
};
350+
} // namespace
349351

350352
typedef std::deque<BasicBlock *> PathType;
351353
typedef std::vector<PathType> PathsType;
@@ -379,6 +381,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const PathType &Path) {
379381
/// by cloning necessary basic blocks and replacing conditional branches with
380382
/// unconditional ones. A threading path includes a list of basic blocks, the
381383
/// exit state, and the block that determines the next state.
384+
namespace {
382385
struct ThreadingPath {
383386
/// Exit value is DFA's exit state for the given path.
384387
APInt getExitValue() const { return ExitVal; }
@@ -1336,6 +1339,7 @@ struct TransformDFA {
13361339
SmallPtrSet<const Value *, 32> EphValues;
13371340
std::vector<ThreadingPath> TPaths;
13381341
};
1342+
} // namespace
13391343

13401344
bool DFAJumpThreading::run(Function &F) {
13411345
LLVM_DEBUG(dbgs() << "\nDFA Jump threading: " << F.getName() << "\n");
@@ -1415,8 +1419,6 @@ bool DFAJumpThreading::run(Function &F) {
14151419
return MadeChanges;
14161420
}
14171421

1418-
} // end anonymous namespace
1419-
14201422
/// Integrate with the new Pass Manager
14211423
PreservedAnalyses DFAJumpThreadingPass::run(Function &F,
14221424
FunctionAnalysisManager &AM) {

0 commit comments

Comments
 (0)