1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[MemorySSA] Make a return type reflect reality. NFC.

llvm-svn: 263286
This commit is contained in:
George Burgess IV 2016-03-11 19:34:03 +00:00
parent 3b791814db
commit e00d07860b
2 changed files with 13 additions and 12 deletions

View File

@ -553,7 +553,7 @@ private:
void computeDomLevels(DenseMap<DomTreeNode *, unsigned> &DomLevels); void computeDomLevels(DenseMap<DomTreeNode *, unsigned> &DomLevels);
void markUnreachableAsLiveOnEntry(BasicBlock *BB); void markUnreachableAsLiveOnEntry(BasicBlock *BB);
bool dominatesUse(const MemoryAccess *, const MemoryAccess *) const; bool dominatesUse(const MemoryAccess *, const MemoryAccess *) const;
MemoryAccess *createNewAccess(Instruction *, bool ignoreNonMemory = false); MemoryUseOrDef *createNewAccess(Instruction *, bool ignoreNonMemory = false);
MemoryAccess *findDominatingDef(BasicBlock *, enum InsertionPlace); MemoryAccess *findDominatingDef(BasicBlock *, enum InsertionPlace);
void removeFromLookups(MemoryAccess *); void removeFromLookups(MemoryAccess *);

View File

@ -257,17 +257,17 @@ MemorySSAWalker *MemorySSA::buildMemorySSA(AliasAnalysis *AA,
bool InsertIntoDef = false; bool InsertIntoDef = false;
AccessListType *Accesses = nullptr; AccessListType *Accesses = nullptr;
for (Instruction &I : B) { for (Instruction &I : B) {
MemoryAccess *MA = createNewAccess(&I, true); MemoryUseOrDef *MUD = createNewAccess(&I, true);
if (!MA) if (!MUD)
continue; continue;
if (isa<MemoryDef>(MA)) if (isa<MemoryDef>(MUD))
InsertIntoDef = true; InsertIntoDef = true;
else if (isa<MemoryUse>(MA)) else
InsertIntoDefUse = true; InsertIntoDefUse = true;
if (!Accesses) if (!Accesses)
Accesses = getOrCreateAccessList(&B); Accesses = getOrCreateAccessList(&B);
Accesses->push_back(MA); Accesses->push_back(MUD);
} }
if (InsertIntoDef) if (InsertIntoDef)
DefiningBlocks.insert(&B); DefiningBlocks.insert(&B);
@ -358,7 +358,8 @@ MemorySSAWalker *MemorySSA::buildMemorySSA(AliasAnalysis *AA,
} }
/// \brief Helper function to create new memory accesses /// \brief Helper function to create new memory accesses
MemoryAccess *MemorySSA::createNewAccess(Instruction *I, bool IgnoreNonMemory) { MemoryUseOrDef *MemorySSA::createNewAccess(Instruction *I,
bool IgnoreNonMemory) {
// Find out what affect this instruction has on memory. // Find out what affect this instruction has on memory.
ModRefInfo ModRef = AA->getModRefInfo(I); ModRefInfo ModRef = AA->getModRefInfo(I);
bool Def = bool(ModRef & MRI_Mod); bool Def = bool(ModRef & MRI_Mod);
@ -372,13 +373,13 @@ MemoryAccess *MemorySSA::createNewAccess(Instruction *I, bool IgnoreNonMemory) {
assert((Def || Use) && assert((Def || Use) &&
"Trying to create a memory access with a non-memory instruction"); "Trying to create a memory access with a non-memory instruction");
MemoryUseOrDef *MA; MemoryUseOrDef *MUD;
if (Def) if (Def)
MA = new MemoryDef(I->getContext(), nullptr, I, I->getParent(), NextID++); MUD = new MemoryDef(I->getContext(), nullptr, I, I->getParent(), NextID++);
else else
MA = new MemoryUse(I->getContext(), nullptr, I, I->getParent()); MUD = new MemoryUse(I->getContext(), nullptr, I, I->getParent());
ValueToMemoryAccess.insert(std::make_pair(I, MA)); ValueToMemoryAccess.insert(std::make_pair(I, MUD));
return MA; return MUD;
} }
MemoryAccess *MemorySSA::findDominatingDef(BasicBlock *UseBlock, MemoryAccess *MemorySSA::findDominatingDef(BasicBlock *UseBlock,