Skip to content

Commit b256d0a

Browse files
authored
[NFC][LLVM] Cleanup namespace usage in DFAJumpThreading.cpp (#162179)
1 parent 01f4510 commit b256d0a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ static cl::opt<double> MaxClonedRate(
129129
cl::Hidden, cl::init(7.5));
130130

131131
namespace {
132-
133132
class SelectInstToUnfold {
134133
SelectInst *SI;
135134
PHINode *SIUse;
@@ -143,10 +142,6 @@ class SelectInstToUnfold {
143142
explicit operator bool() const { return SI && SIUse; }
144143
};
145144

146-
void unfold(DomTreeUpdater *DTU, LoopInfo *LI, SelectInstToUnfold SIToUnfold,
147-
std::vector<SelectInstToUnfold> *NewSIsToUnfold,
148-
std::vector<BasicBlock *> *NewBBs);
149-
150145
class DFAJumpThreading {
151146
public:
152147
DFAJumpThreading(AssumptionCache *AC, DominatorTree *DT, LoopInfo *LI,
@@ -176,16 +171,18 @@ class DFAJumpThreading {
176171
}
177172
}
178173

174+
static void unfold(DomTreeUpdater *DTU, LoopInfo *LI,
175+
SelectInstToUnfold SIToUnfold,
176+
std::vector<SelectInstToUnfold> *NewSIsToUnfold,
177+
std::vector<BasicBlock *> *NewBBs);
178+
179179
AssumptionCache *AC;
180180
DominatorTree *DT;
181181
LoopInfo *LI;
182182
TargetTransformInfo *TTI;
183183
OptimizationRemarkEmitter *ORE;
184184
};
185-
186-
} // end anonymous namespace
187-
188-
namespace {
185+
} // namespace
189186

190187
/// Unfold the select instruction held in \p SIToUnfold by replacing it with
191188
/// control flow.
@@ -194,9 +191,10 @@ namespace {
194191
/// created basic blocks into \p NewBBs.
195192
///
196193
/// TODO: merge it with CodeGenPrepare::optimizeSelectInst() if possible.
197-
void unfold(DomTreeUpdater *DTU, LoopInfo *LI, SelectInstToUnfold SIToUnfold,
198-
std::vector<SelectInstToUnfold> *NewSIsToUnfold,
199-
std::vector<BasicBlock *> *NewBBs) {
194+
void DFAJumpThreading::unfold(DomTreeUpdater *DTU, LoopInfo *LI,
195+
SelectInstToUnfold SIToUnfold,
196+
std::vector<SelectInstToUnfold> *NewSIsToUnfold,
197+
std::vector<BasicBlock *> *NewBBs) {
200198
SelectInst *SI = SIToUnfold.getInst();
201199
PHINode *SIUse = SIToUnfold.getUse();
202200
assert(SI->hasOneUse());
@@ -351,10 +349,12 @@ void unfold(DomTreeUpdater *DTU, LoopInfo *LI, SelectInstToUnfold SIToUnfold,
351349
SI->eraseFromParent();
352350
}
353351

352+
namespace {
354353
struct ClonedBlock {
355354
BasicBlock *BB;
356355
APInt State; ///< \p State corresponds to the next value of a switch stmnt.
357356
};
357+
} // namespace
358358

359359
typedef std::deque<BasicBlock *> PathType;
360360
typedef std::vector<PathType> PathsType;
@@ -384,6 +384,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const PathType &Path) {
384384
return OS;
385385
}
386386

387+
namespace {
387388
/// ThreadingPath is a path in the control flow of a loop that can be threaded
388389
/// by cloning necessary basic blocks and replacing conditional branches with
389390
/// unconditional ones. A threading path includes a list of basic blocks, the
@@ -1366,6 +1367,7 @@ struct TransformDFA {
13661367
SmallPtrSet<const Value *, 32> EphValues;
13671368
std::vector<ThreadingPath> TPaths;
13681369
};
1370+
} // namespace
13691371

13701372
bool DFAJumpThreading::run(Function &F) {
13711373
LLVM_DEBUG(dbgs() << "\nDFA Jump threading: " << F.getName() << "\n");
@@ -1444,8 +1446,6 @@ bool DFAJumpThreading::run(Function &F) {
14441446
return MadeChanges;
14451447
}
14461448

1447-
} // end anonymous namespace
1448-
14491449
/// Integrate with the new Pass Manager
14501450
PreservedAnalyses DFAJumpThreadingPass::run(Function &F,
14511451
FunctionAnalysisManager &AM) {

0 commit comments

Comments
 (0)