mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
LazyValueInfo: range'ify some for-loops. No functional change.
llvm-svn: 222557
This commit is contained in:
parent
f10986a833
commit
ffb28ee503
@ -439,17 +439,11 @@ void LVIValueHandle::deleted() {
|
|||||||
typedef std::pair<AssertingVH<BasicBlock>, Value*> OverDefinedPairTy;
|
typedef std::pair<AssertingVH<BasicBlock>, Value*> OverDefinedPairTy;
|
||||||
|
|
||||||
SmallVector<OverDefinedPairTy, 4> ToErase;
|
SmallVector<OverDefinedPairTy, 4> ToErase;
|
||||||
for (DenseSet<OverDefinedPairTy>::iterator
|
for (const OverDefinedPairTy &P : Parent->OverDefinedCache)
|
||||||
I = Parent->OverDefinedCache.begin(),
|
if (P.second == getValPtr())
|
||||||
E = Parent->OverDefinedCache.end();
|
ToErase.push_back(P);
|
||||||
I != E; ++I) {
|
for (const OverDefinedPairTy &P : ToErase)
|
||||||
if (I->second == getValPtr())
|
Parent->OverDefinedCache.erase(P);
|
||||||
ToErase.push_back(*I);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (SmallVectorImpl<OverDefinedPairTy>::iterator I = ToErase.begin(),
|
|
||||||
E = ToErase.end(); I != E; ++I)
|
|
||||||
Parent->OverDefinedCache.erase(*I);
|
|
||||||
|
|
||||||
// This erasure deallocates *this, so it MUST happen after we're done
|
// This erasure deallocates *this, so it MUST happen after we're done
|
||||||
// using any and all members of *this.
|
// using any and all members of *this.
|
||||||
@ -464,15 +458,11 @@ void LazyValueInfoCache::eraseBlock(BasicBlock *BB) {
|
|||||||
SeenBlocks.erase(I);
|
SeenBlocks.erase(I);
|
||||||
|
|
||||||
SmallVector<OverDefinedPairTy, 4> ToErase;
|
SmallVector<OverDefinedPairTy, 4> ToErase;
|
||||||
for (DenseSet<OverDefinedPairTy>::iterator I = OverDefinedCache.begin(),
|
for (const OverDefinedPairTy& P : OverDefinedCache)
|
||||||
E = OverDefinedCache.end(); I != E; ++I) {
|
if (P.first == BB)
|
||||||
if (I->first == BB)
|
ToErase.push_back(P);
|
||||||
ToErase.push_back(*I);
|
for (const OverDefinedPairTy &P : ToErase)
|
||||||
}
|
OverDefinedCache.erase(P);
|
||||||
|
|
||||||
for (SmallVectorImpl<OverDefinedPairTy>::iterator I = ToErase.begin(),
|
|
||||||
E = ToErase.end(); I != E; ++I)
|
|
||||||
OverDefinedCache.erase(*I);
|
|
||||||
|
|
||||||
for (std::map<LVIValueHandle, ValueCacheEntryTy>::iterator
|
for (std::map<LVIValueHandle, ValueCacheEntryTy>::iterator
|
||||||
I = ValueCache.begin(), E = ValueCache.end(); I != E; ++I)
|
I = ValueCache.begin(), E = ValueCache.end(); I != E; ++I)
|
||||||
@ -620,9 +610,8 @@ bool LazyValueInfoCache::solveBlockValueNonLocal(LVILatticeVal &BBLV,
|
|||||||
// If 'GetUnderlyingObject' didn't converge, skip it. It won't converge
|
// If 'GetUnderlyingObject' didn't converge, skip it. It won't converge
|
||||||
// inside InstructionDereferencesPointer either.
|
// inside InstructionDereferencesPointer either.
|
||||||
if (UnderlyingVal == GetUnderlyingObject(UnderlyingVal, nullptr, 1)) {
|
if (UnderlyingVal == GetUnderlyingObject(UnderlyingVal, nullptr, 1)) {
|
||||||
for (BasicBlock::iterator BI = BB->begin(), BE = BB->end();
|
for (Instruction &I : *BB) {
|
||||||
BI != BE; ++BI) {
|
if (InstructionDereferencesPointer(&I, UnderlyingVal)) {
|
||||||
if (InstructionDereferencesPointer(BI, UnderlyingVal)) {
|
|
||||||
NotNull = true;
|
NotNull = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -915,8 +904,7 @@ static bool getEdgeValueLocal(Value *Val, BasicBlock *BBFrom,
|
|||||||
unsigned BitWidth = Val->getType()->getIntegerBitWidth();
|
unsigned BitWidth = Val->getType()->getIntegerBitWidth();
|
||||||
ConstantRange EdgesVals(BitWidth, DefaultCase/*isFullSet*/);
|
ConstantRange EdgesVals(BitWidth, DefaultCase/*isFullSet*/);
|
||||||
|
|
||||||
for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end();
|
for (SwitchInst::CaseIt i : SI->cases()) {
|
||||||
i != e; ++i) {
|
|
||||||
ConstantRange EdgeVal(i.getCaseValue()->getValue());
|
ConstantRange EdgeVal(i.getCaseValue()->getValue());
|
||||||
if (DefaultCase) {
|
if (DefaultCase) {
|
||||||
// It is possible that the default destination is the destination of
|
// It is possible that the default destination is the destination of
|
||||||
@ -1050,11 +1038,9 @@ void LazyValueInfoCache::threadEdge(BasicBlock *PredBB, BasicBlock *OldSucc,
|
|||||||
worklist.push_back(OldSucc);
|
worklist.push_back(OldSucc);
|
||||||
|
|
||||||
DenseSet<Value*> ClearSet;
|
DenseSet<Value*> ClearSet;
|
||||||
for (DenseSet<OverDefinedPairTy>::iterator I = OverDefinedCache.begin(),
|
for (OverDefinedPairTy &P : OverDefinedCache)
|
||||||
E = OverDefinedCache.end(); I != E; ++I) {
|
if (P.first == OldSucc)
|
||||||
if (I->first == OldSucc)
|
ClearSet.insert(P.second);
|
||||||
ClearSet.insert(I->second);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use a worklist to perform a depth-first search of OldSucc's successors.
|
// Use a worklist to perform a depth-first search of OldSucc's successors.
|
||||||
// NOTE: We do not need a visited list since any blocks we have already
|
// NOTE: We do not need a visited list since any blocks we have already
|
||||||
@ -1068,15 +1054,14 @@ void LazyValueInfoCache::threadEdge(BasicBlock *PredBB, BasicBlock *OldSucc,
|
|||||||
if (ToUpdate == NewSucc) continue;
|
if (ToUpdate == NewSucc) continue;
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
for (DenseSet<Value*>::iterator I = ClearSet.begin(), E = ClearSet.end();
|
for (Value *V : ClearSet) {
|
||||||
I != E; ++I) {
|
|
||||||
// If a value was marked overdefined in OldSucc, and is here too...
|
// If a value was marked overdefined in OldSucc, and is here too...
|
||||||
DenseSet<OverDefinedPairTy>::iterator OI =
|
DenseSet<OverDefinedPairTy>::iterator OI =
|
||||||
OverDefinedCache.find(std::make_pair(ToUpdate, *I));
|
OverDefinedCache.find(std::make_pair(ToUpdate, V));
|
||||||
if (OI == OverDefinedCache.end()) continue;
|
if (OI == OverDefinedCache.end()) continue;
|
||||||
|
|
||||||
// Remove it from the caches.
|
// Remove it from the caches.
|
||||||
ValueCacheEntryTy &Entry = ValueCache[LVIValueHandle(*I, this)];
|
ValueCacheEntryTy &Entry = ValueCache[LVIValueHandle(V, this)];
|
||||||
ValueCacheEntryTy::iterator CI = Entry.find(ToUpdate);
|
ValueCacheEntryTy::iterator CI = Entry.find(ToUpdate);
|
||||||
|
|
||||||
assert(CI != Entry.end() && "Couldn't find entry to update?");
|
assert(CI != Entry.end() && "Couldn't find entry to update?");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user