[PM/AA] Reformat GlobalsModRef so that subsequent patches I make here

don't continually introduce formatting deltas. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242129 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chandler Carruth
2015-07-14 08:42:39 +00:00
parent 936924f3fd
commit 2364d1f548

View File

@@ -191,13 +191,13 @@ namespace {
}
char GlobalsModRef::ID = 0;
INITIALIZE_AG_PASS_BEGIN(GlobalsModRef, AliasAnalysis,
"globalsmodref-aa", "Simple mod/ref analysis for globals",
false, true, false)
INITIALIZE_AG_PASS_BEGIN(GlobalsModRef, AliasAnalysis, "globalsmodref-aa",
"Simple mod/ref analysis for globals", false, true,
false)
INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)
INITIALIZE_AG_PASS_END(GlobalsModRef, AliasAnalysis,
"globalsmodref-aa", "Simple mod/ref analysis for globals",
false, true, false)
INITIALIZE_AG_PASS_END(GlobalsModRef, AliasAnalysis, "globalsmodref-aa",
"Simple mod/ref analysis for globals", false, true,
false)
Pass *llvm::createGlobalsModRefPass() { return new GlobalsModRef(); }
@@ -214,11 +214,12 @@ void GlobalsModRef::AnalyzeGlobals(Module &M) {
NonAddressTakenGlobals.insert(I);
++NumNonAddrTakenFunctions;
}
Readers.clear(); Writers.clear();
Readers.clear();
Writers.clear();
}
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
I != E; ++I)
for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E;
++I)
if (I->hasLocalLinkage()) {
if (!AnalyzeUsesOfPointer(I, Readers, Writers)) {
// Remember that we are tracking this global, and the mod/ref fns
@@ -237,7 +238,8 @@ void GlobalsModRef::AnalyzeGlobals(Module &M) {
AnalyzeIndirectGlobalMemory(I))
++NumIndirectGlobalVars;
}
Readers.clear(); Writers.clear();
Readers.clear();
Writers.clear();
}
}
@@ -251,7 +253,8 @@ bool GlobalsModRef::AnalyzeUsesOfPointer(Value *V,
std::vector<Function *> &Readers,
std::vector<Function *> &Writers,
GlobalValue *OkayStoreDest) {
if (!V->getType()->isPointerTy()) return true;
if (!V->getType()->isPointerTy())
return true;
for (Use &U : V->uses()) {
User *I = U.getUser();
@@ -315,7 +318,8 @@ bool GlobalsModRef::AnalyzeIndirectGlobalMemory(GlobalValue *GV) {
// TODO: Could try some IP mod/ref of the loaded pointer.
} else if (StoreInst *SI = dyn_cast<StoreInst>(U)) {
// Storing the global itself.
if (SI->getOperand(0) == GV) return false;
if (SI->getOperand(0) == GV)
return false;
// If storing the null pointer, ignore it.
if (isa<ConstantPointerNull>(SI->getOperand(0)))
@@ -436,7 +440,8 @@ void GlobalsModRef::AnalyzeCallGraph(CallGraph &CG, Module &M) {
}
// Scan the function bodies for explicit loads or stores.
for (unsigned i = 0, e = SCC.size(); i != e && FunctionEffect != ModRef;++i)
for (unsigned i = 0, e = SCC.size(); i != e && FunctionEffect != ModRef;
++i)
for (inst_iterator II = inst_begin(SCC[i]->getFunction()),
E = inst_end(SCC[i]->getFunction());
II != E && FunctionEffect != ModRef; ++II)
@@ -473,8 +478,6 @@ void GlobalsModRef::AnalyzeCallGraph(CallGraph &CG, Module &M) {
}
}
/// alias - If one of the pointers is to a global that we are tracking, and the
/// other is some random pointer, we know there cannot be an alias, because the
/// address of the global isn't taken.
@@ -491,8 +494,10 @@ AliasResult GlobalsModRef::alias(const MemoryLocation &LocA,
if (GV1 || GV2) {
// If the global's address is taken, pretend we don't know it's a pointer to
// the global.
if (GV1 && !NonAddressTakenGlobals.count(GV1)) GV1 = nullptr;
if (GV2 && !NonAddressTakenGlobals.count(GV2)) GV2 = nullptr;
if (GV1 && !NonAddressTakenGlobals.count(GV1))
GV1 = nullptr;
if (GV2 && !NonAddressTakenGlobals.count(GV2))
GV2 = nullptr;
// If the two pointers are derived from two different non-addr-taken
// globals, or if one is and the other isn't, we know these can't alias.
@@ -553,7 +558,6 @@ GlobalsModRef::getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
return ModRefResult(Known & AliasAnalysis::getModRefInfo(CS, Loc));
}
//===----------------------------------------------------------------------===//
// Methods to update the analysis as a result of the client transformation.
//
@@ -566,7 +570,8 @@ void GlobalsModRef::deleteValue(Value *V) {
// Remove any entries in AllocsForIndirectGlobals for this global.
for (std::map<const Value *, const GlobalValue *>::iterator
I = AllocsForIndirectGlobals.begin(),
E = AllocsForIndirectGlobals.end(); I != E; ) {
E = AllocsForIndirectGlobals.end();
I != E;) {
if (I->second == GV) {
AllocsForIndirectGlobals.erase(I++);
} else {