@@ -129,7 +129,6 @@ static cl::opt<double> MaxClonedRate(
129
129
cl::Hidden, cl::init(7.5 ));
130
130
131
131
namespace {
132
-
133
132
class SelectInstToUnfold {
134
133
SelectInst *SI;
135
134
PHINode *SIUse;
@@ -143,10 +142,6 @@ class SelectInstToUnfold {
143
142
explicit operator bool () const { return SI && SIUse; }
144
143
};
145
144
146
- void unfold (DomTreeUpdater *DTU, LoopInfo *LI, SelectInstToUnfold SIToUnfold,
147
- std::vector<SelectInstToUnfold> *NewSIsToUnfold,
148
- std::vector<BasicBlock *> *NewBBs);
149
-
150
145
class DFAJumpThreading {
151
146
public:
152
147
DFAJumpThreading (AssumptionCache *AC, DominatorTree *DT, LoopInfo *LI,
@@ -176,16 +171,18 @@ class DFAJumpThreading {
176
171
}
177
172
}
178
173
174
+ static void unfold (DomTreeUpdater *DTU, LoopInfo *LI,
175
+ SelectInstToUnfold SIToUnfold,
176
+ std::vector<SelectInstToUnfold> *NewSIsToUnfold,
177
+ std::vector<BasicBlock *> *NewBBs);
178
+
179
179
AssumptionCache *AC;
180
180
DominatorTree *DT;
181
181
LoopInfo *LI;
182
182
TargetTransformInfo *TTI;
183
183
OptimizationRemarkEmitter *ORE;
184
184
};
185
-
186
- } // end anonymous namespace
187
-
188
- namespace {
185
+ } // namespace
189
186
190
187
// / Unfold the select instruction held in \p SIToUnfold by replacing it with
191
188
// / control flow.
@@ -194,9 +191,10 @@ namespace {
194
191
// / created basic blocks into \p NewBBs.
195
192
// /
196
193
// / 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) {
200
198
SelectInst *SI = SIToUnfold.getInst ();
201
199
PHINode *SIUse = SIToUnfold.getUse ();
202
200
assert (SI->hasOneUse ());
@@ -351,10 +349,12 @@ void unfold(DomTreeUpdater *DTU, LoopInfo *LI, SelectInstToUnfold SIToUnfold,
351
349
SI->eraseFromParent ();
352
350
}
353
351
352
+ namespace {
354
353
struct ClonedBlock {
355
354
BasicBlock *BB;
356
355
APInt State; // /< \p State corresponds to the next value of a switch stmnt.
357
356
};
357
+ } // namespace
358
358
359
359
typedef std::deque<BasicBlock *> PathType;
360
360
typedef std::vector<PathType> PathsType;
@@ -384,6 +384,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const PathType &Path) {
384
384
return OS;
385
385
}
386
386
387
+ namespace {
387
388
// / ThreadingPath is a path in the control flow of a loop that can be threaded
388
389
// / by cloning necessary basic blocks and replacing conditional branches with
389
390
// / unconditional ones. A threading path includes a list of basic blocks, the
@@ -1366,6 +1367,7 @@ struct TransformDFA {
1366
1367
SmallPtrSet<const Value *, 32 > EphValues;
1367
1368
std::vector<ThreadingPath> TPaths;
1368
1369
};
1370
+ } // namespace
1369
1371
1370
1372
bool DFAJumpThreading::run (Function &F) {
1371
1373
LLVM_DEBUG (dbgs () << " \n DFA Jump threading: " << F.getName () << " \n " );
@@ -1444,8 +1446,6 @@ bool DFAJumpThreading::run(Function &F) {
1444
1446
return MadeChanges;
1445
1447
}
1446
1448
1447
- } // end anonymous namespace
1448
-
1449
1449
// / Integrate with the new Pass Manager
1450
1450
PreservedAnalyses DFAJumpThreadingPass::run (Function &F,
1451
1451
FunctionAnalysisManager &AM) {
0 commit comments