mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
Cleanup in preparation for D30703. NFCI
Make the enumerators follow the coding convention and start with OW_... llvm-svn: 298996
This commit is contained in:
parent
1be3f21c7b
commit
c74a7545e9
@ -287,19 +287,14 @@ static uint64_t getPointerSize(const Value *V, const DataLayout &DL,
|
||||
}
|
||||
|
||||
namespace {
|
||||
enum OverwriteResult {
|
||||
OverwriteBegin,
|
||||
OverwriteComplete,
|
||||
OverwriteEnd,
|
||||
OverwriteUnknown
|
||||
};
|
||||
enum OverwriteResult { OW_Begin, OW_Complete, OW_End, OW_Unknown };
|
||||
}
|
||||
|
||||
/// Return 'OverwriteComplete' if a store to the 'Later' location completely
|
||||
/// overwrites a store to the 'Earlier' location, 'OverwriteEnd' if the end of
|
||||
/// the 'Earlier' location is completely overwritten by 'Later',
|
||||
/// 'OverwriteBegin' if the beginning of the 'Earlier' location is overwritten
|
||||
/// by 'Later', or 'OverwriteUnknown' if nothing can be determined.
|
||||
/// Return 'OW_Complete' if a store to the 'Later' location completely
|
||||
/// overwrites a store to the 'Earlier' location, 'OW_End' if the end of the
|
||||
/// 'Earlier' location is completely overwritten by 'Later', 'OW_Begin' if the
|
||||
/// beginning of the 'Earlier' location is overwritten by 'Later', or
|
||||
/// 'OW_Unknown' if nothing can be determined.
|
||||
static OverwriteResult isOverwrite(const MemoryLocation &Later,
|
||||
const MemoryLocation &Earlier,
|
||||
const DataLayout &DL,
|
||||
@ -310,7 +305,7 @@ static OverwriteResult isOverwrite(const MemoryLocation &Later,
|
||||
// If we don't know the sizes of either access, then we can't do a comparison.
|
||||
if (Later.Size == MemoryLocation::UnknownSize ||
|
||||
Earlier.Size == MemoryLocation::UnknownSize)
|
||||
return OverwriteUnknown;
|
||||
return OW_Unknown;
|
||||
|
||||
const Value *P1 = Earlier.Ptr->stripPointerCasts();
|
||||
const Value *P2 = Later.Ptr->stripPointerCasts();
|
||||
@ -320,7 +315,7 @@ static OverwriteResult isOverwrite(const MemoryLocation &Later,
|
||||
if (P1 == P2) {
|
||||
// Make sure that the Later size is >= the Earlier size.
|
||||
if (Later.Size >= Earlier.Size)
|
||||
return OverwriteComplete;
|
||||
return OW_Complete;
|
||||
}
|
||||
|
||||
// Check to see if the later store is to the entire object (either a global,
|
||||
@ -332,13 +327,13 @@ static OverwriteResult isOverwrite(const MemoryLocation &Later,
|
||||
// If we can't resolve the same pointers to the same object, then we can't
|
||||
// analyze them at all.
|
||||
if (UO1 != UO2)
|
||||
return OverwriteUnknown;
|
||||
return OW_Unknown;
|
||||
|
||||
// If the "Later" store is to a recognizable object, get its size.
|
||||
uint64_t ObjectSize = getPointerSize(UO2, DL, TLI);
|
||||
if (ObjectSize != MemoryLocation::UnknownSize)
|
||||
if (ObjectSize == Later.Size && ObjectSize >= Earlier.Size)
|
||||
return OverwriteComplete;
|
||||
return OW_Complete;
|
||||
|
||||
// Okay, we have stores to two completely different pointers. Try to
|
||||
// decompose the pointer into a "base + constant_offset" form. If the base
|
||||
@ -350,7 +345,7 @@ static OverwriteResult isOverwrite(const MemoryLocation &Later,
|
||||
|
||||
// If the base pointers still differ, we have two completely different stores.
|
||||
if (BP1 != BP2)
|
||||
return OverwriteUnknown;
|
||||
return OW_Unknown;
|
||||
|
||||
// The later store completely overlaps the earlier store if:
|
||||
//
|
||||
@ -370,7 +365,7 @@ static OverwriteResult isOverwrite(const MemoryLocation &Later,
|
||||
if (EarlierOff >= LaterOff &&
|
||||
Later.Size >= Earlier.Size &&
|
||||
uint64_t(EarlierOff - LaterOff) + Earlier.Size <= Later.Size)
|
||||
return OverwriteComplete;
|
||||
return OW_Complete;
|
||||
|
||||
// We may now overlap, although the overlap is not complete. There might also
|
||||
// be other incomplete overlaps, and together, they might cover the complete
|
||||
@ -428,7 +423,7 @@ static OverwriteResult isOverwrite(const MemoryLocation &Later,
|
||||
") Composite Later [" <<
|
||||
ILI->second << ", " << ILI->first << ")\n");
|
||||
++NumCompletePartials;
|
||||
return OverwriteComplete;
|
||||
return OW_Complete;
|
||||
}
|
||||
}
|
||||
|
||||
@ -443,7 +438,7 @@ static OverwriteResult isOverwrite(const MemoryLocation &Later,
|
||||
if (!EnablePartialOverwriteTracking &&
|
||||
(LaterOff > EarlierOff && LaterOff < int64_t(EarlierOff + Earlier.Size) &&
|
||||
int64_t(LaterOff + Later.Size) >= int64_t(EarlierOff + Earlier.Size)))
|
||||
return OverwriteEnd;
|
||||
return OW_End;
|
||||
|
||||
// Finally, we also need to check if the later store overwrites the beginning
|
||||
// of the earlier store.
|
||||
@ -458,11 +453,11 @@ static OverwriteResult isOverwrite(const MemoryLocation &Later,
|
||||
(LaterOff <= EarlierOff && int64_t(LaterOff + Later.Size) > EarlierOff)) {
|
||||
assert(int64_t(LaterOff + Later.Size) <
|
||||
int64_t(EarlierOff + Earlier.Size) &&
|
||||
"Expect to be handled as OverwriteComplete");
|
||||
return OverwriteBegin;
|
||||
"Expect to be handled as OW_Complete");
|
||||
return OW_Begin;
|
||||
}
|
||||
// Otherwise, they don't completely overlap.
|
||||
return OverwriteUnknown;
|
||||
return OW_Unknown;
|
||||
}
|
||||
|
||||
/// If 'Inst' might be a self read (i.e. a noop copy of a
|
||||
@ -909,7 +904,7 @@ static bool tryToShortenBegin(Instruction *EarlierWrite,
|
||||
|
||||
if (LaterStart <= EarlierStart && LaterStart + LaterSize > EarlierStart) {
|
||||
assert(LaterStart + LaterSize < EarlierStart + EarlierSize &&
|
||||
"Should have been handled as OverwriteComplete");
|
||||
"Should have been handled as OW_Complete");
|
||||
if (tryToShorten(EarlierWrite, EarlierStart, EarlierSize, LaterStart,
|
||||
LaterSize, false)) {
|
||||
IntervalMap.erase(OII);
|
||||
@ -1105,7 +1100,7 @@ static bool eliminateDeadStores(BasicBlock &BB, AliasAnalysis *AA,
|
||||
OverwriteResult OR =
|
||||
isOverwrite(Loc, DepLoc, DL, *TLI, DepWriteOffset, InstWriteOffset,
|
||||
DepWrite, IOL);
|
||||
if (OR == OverwriteComplete) {
|
||||
if (OR == OW_Complete) {
|
||||
DEBUG(dbgs() << "DSE: Remove Dead Store:\n DEAD: "
|
||||
<< *DepWrite << "\n KILLER: " << *Inst << '\n');
|
||||
|
||||
@ -1117,15 +1112,15 @@ static bool eliminateDeadStores(BasicBlock &BB, AliasAnalysis *AA,
|
||||
// We erased DepWrite; start over.
|
||||
InstDep = MD->getDependency(Inst);
|
||||
continue;
|
||||
} else if ((OR == OverwriteEnd && isShortenableAtTheEnd(DepWrite)) ||
|
||||
((OR == OverwriteBegin &&
|
||||
} else if ((OR == OW_End && isShortenableAtTheEnd(DepWrite)) ||
|
||||
((OR == OW_Begin &&
|
||||
isShortenableAtTheBeginning(DepWrite)))) {
|
||||
assert(!EnablePartialOverwriteTracking && "Do not expect to perform "
|
||||
"when partial-overwrite "
|
||||
"tracking is enabled");
|
||||
int64_t EarlierSize = DepLoc.Size;
|
||||
int64_t LaterSize = Loc.Size;
|
||||
bool IsOverwriteEnd = (OR == OverwriteEnd);
|
||||
bool IsOverwriteEnd = (OR == OW_End);
|
||||
MadeChange |= tryToShorten(DepWrite, DepWriteOffset, EarlierSize,
|
||||
InstWriteOffset, LaterSize, IsOverwriteEnd);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user