Skip to content

Commit 721a360

Browse files
authored
[NFC][LLVM] Namespace cleanup in LICM (#163594)
1 parent 883c99f commit 721a360

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

llvm/lib/Transforms/Scalar/LICM.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ STATISTIC(NumIntAssociationsHoisted,
116116
STATISTIC(NumBOAssociationsHoisted, "Number of invariant BinaryOp expressions "
117117
"reassociated and hoisted out of the loop");
118118

119-
namespace llvm {
120-
121119
/// Memory promotion is enabled by default.
122120
static cl::opt<bool>
123121
DisablePromotion("disable-licm-promotion", cl::Hidden, cl::init(false),
@@ -156,23 +154,23 @@ static cl::opt<unsigned> IntAssociationUpperLimit(
156154
// which may not be precise, since optimizeUses is capped. The result is
157155
// correct, but we may not get as "far up" as possible to get which access is
158156
// clobbering the one queried.
159-
cl::opt<unsigned> SetLicmMssaOptCap(
157+
cl::opt<unsigned> llvm::SetLicmMssaOptCap(
160158
"licm-mssa-optimization-cap", cl::init(100), cl::Hidden,
161159
cl::desc("Enable imprecision in LICM in pathological cases, in exchange "
162160
"for faster compile. Caps the MemorySSA clobbering calls."));
163161

164162
// Experimentally, memory promotion carries less importance than sinking and
165163
// hoisting. Limit when we do promotion when using MemorySSA, in order to save
166164
// compile time.
167-
cl::opt<unsigned> SetLicmMssaNoAccForPromotionCap(
165+
cl::opt<unsigned> llvm::SetLicmMssaNoAccForPromotionCap(
168166
"licm-mssa-max-acc-promotion", cl::init(250), cl::Hidden,
169167
cl::desc("[LICM & MemorySSA] When MSSA in LICM is disabled, this has no "
170168
"effect. When MSSA in LICM is enabled, then this is the maximum "
171169
"number of accesses allowed to be present in a loop in order to "
172170
"enable memory promotion."));
173171

172+
namespace llvm {
174173
extern cl::opt<bool> ProfcheckDisableMetadataFixes;
175-
176174
} // end namespace llvm
177175

178176
static bool inSubLoop(BasicBlock *BB, Loop *CurLoop, LoopInfo *LI);
@@ -1120,11 +1118,10 @@ static bool isLoadInvariantInLoop(LoadInst *LI, DominatorTree *DT,
11201118
return false;
11211119
}
11221120

1123-
namespace {
11241121
/// Return true if-and-only-if we know how to (mechanically) both hoist and
11251122
/// sink a given instruction out of a loop. Does not address legality
11261123
/// concerns such as aliasing or speculation safety.
1127-
bool isHoistableAndSinkableInst(Instruction &I) {
1124+
static bool isHoistableAndSinkableInst(Instruction &I) {
11281125
// Only these instructions are hoistable/sinkable.
11291126
return (isa<LoadInst>(I) || isa<StoreInst>(I) || isa<CallInst>(I) ||
11301127
isa<FenceInst>(I) || isa<CastInst>(I) || isa<UnaryOperator>(I) ||
@@ -1136,8 +1133,8 @@ bool isHoistableAndSinkableInst(Instruction &I) {
11361133
}
11371134

11381135
/// Return true if I is the only Instruction with a MemoryAccess in L.
1139-
bool isOnlyMemoryAccess(const Instruction *I, const Loop *L,
1140-
const MemorySSAUpdater &MSSAU) {
1136+
static bool isOnlyMemoryAccess(const Instruction *I, const Loop *L,
1137+
const MemorySSAUpdater &MSSAU) {
11411138
for (auto *BB : L->getBlocks())
11421139
if (auto *Accs = MSSAU.getMemorySSA()->getBlockAccesses(BB)) {
11431140
int NotAPhi = 0;
@@ -1151,7 +1148,6 @@ bool isOnlyMemoryAccess(const Instruction *I, const Loop *L,
11511148
}
11521149
return true;
11531150
}
1154-
}
11551151

11561152
static MemoryAccess *getClobberingMemoryAccess(MemorySSA &MSSA,
11571153
BatchAAResults &BAA,

0 commit comments

Comments
 (0)