forked from OSchip/llvm-project
Apply clang-tidy's modernize-loop-convert to lib/Analysis.
Only minor manual fixes. No functionality change intended. llvm-svn: 273816
This commit is contained in:
parent
d8db1e172c
commit
aa2091505f
|
@ -67,8 +67,9 @@ public:
|
|||
|
||||
/// contains - Find out if a basic block is in this interval
|
||||
inline bool contains(BasicBlock *BB) const {
|
||||
for (unsigned i = 0; i < Nodes.size(); ++i)
|
||||
if (Nodes[i] == BB) return true;
|
||||
for (BasicBlock *Node : Nodes)
|
||||
if (Node == BB)
|
||||
return true;
|
||||
return false;
|
||||
// I don't want the dependency on <algorithm>
|
||||
//return find(Nodes.begin(), Nodes.end(), BB) != Nodes.end();
|
||||
|
@ -76,8 +77,9 @@ public:
|
|||
|
||||
/// isSuccessor - find out if a basic block is a successor of this Interval
|
||||
inline bool isSuccessor(BasicBlock *BB) const {
|
||||
for (unsigned i = 0; i < Successors.size(); ++i)
|
||||
if (Successors[i] == BB) return true;
|
||||
for (BasicBlock *Successor : Successors)
|
||||
if (Successor == BB)
|
||||
return true;
|
||||
return false;
|
||||
// I don't want the dependency on <algorithm>
|
||||
//return find(Successors.begin(), Successors.end(), BB) != Successors.end();
|
||||
|
|
|
@ -175,29 +175,27 @@ void AAEvaluator::runInternal(Function &F, AAResults &AA) {
|
|||
|
||||
if (EvalAAMD) {
|
||||
// iterate over all pairs of load, store
|
||||
for (SetVector<Value *>::iterator I1 = Loads.begin(), E = Loads.end();
|
||||
I1 != E; ++I1) {
|
||||
for (SetVector<Value *>::iterator I2 = Stores.begin(), E2 = Stores.end();
|
||||
I2 != E2; ++I2) {
|
||||
switch (AA.alias(MemoryLocation::get(cast<LoadInst>(*I1)),
|
||||
MemoryLocation::get(cast<StoreInst>(*I2)))) {
|
||||
for (Value *Load : Loads) {
|
||||
for (Value *Store : Stores) {
|
||||
switch (AA.alias(MemoryLocation::get(cast<LoadInst>(Load)),
|
||||
MemoryLocation::get(cast<StoreInst>(Store)))) {
|
||||
case NoAlias:
|
||||
PrintLoadStoreResults("NoAlias", PrintNoAlias, *I1, *I2,
|
||||
PrintLoadStoreResults("NoAlias", PrintNoAlias, Load, Store,
|
||||
F.getParent());
|
||||
++NoAliasCount;
|
||||
break;
|
||||
case MayAlias:
|
||||
PrintLoadStoreResults("MayAlias", PrintMayAlias, *I1, *I2,
|
||||
PrintLoadStoreResults("MayAlias", PrintMayAlias, Load, Store,
|
||||
F.getParent());
|
||||
++MayAliasCount;
|
||||
break;
|
||||
case PartialAlias:
|
||||
PrintLoadStoreResults("PartialAlias", PrintPartialAlias, *I1, *I2,
|
||||
PrintLoadStoreResults("PartialAlias", PrintPartialAlias, Load, Store,
|
||||
F.getParent());
|
||||
++PartialAliasCount;
|
||||
break;
|
||||
case MustAlias:
|
||||
PrintLoadStoreResults("MustAlias", PrintMustAlias, *I1, *I2,
|
||||
PrintLoadStoreResults("MustAlias", PrintMustAlias, Load, Store,
|
||||
F.getParent());
|
||||
++MustAliasCount;
|
||||
break;
|
||||
|
@ -237,30 +235,31 @@ void AAEvaluator::runInternal(Function &F, AAResults &AA) {
|
|||
}
|
||||
|
||||
// Mod/ref alias analysis: compare all pairs of calls and values
|
||||
for (auto C = CallSites.begin(), Ce = CallSites.end(); C != Ce; ++C) {
|
||||
Instruction *I = C->getInstruction();
|
||||
for (CallSite C : CallSites) {
|
||||
Instruction *I = C.getInstruction();
|
||||
|
||||
for (SetVector<Value *>::iterator V = Pointers.begin(), Ve = Pointers.end();
|
||||
V != Ve; ++V) {
|
||||
for (auto Pointer : Pointers) {
|
||||
uint64_t Size = MemoryLocation::UnknownSize;
|
||||
Type *ElTy = cast<PointerType>((*V)->getType())->getElementType();
|
||||
Type *ElTy = cast<PointerType>(Pointer->getType())->getElementType();
|
||||
if (ElTy->isSized()) Size = DL.getTypeStoreSize(ElTy);
|
||||
|
||||
switch (AA.getModRefInfo(*C, *V, Size)) {
|
||||
switch (AA.getModRefInfo(C, Pointer, Size)) {
|
||||
case MRI_NoModRef:
|
||||
PrintModRefResults("NoModRef", PrintNoModRef, I, *V, F.getParent());
|
||||
PrintModRefResults("NoModRef", PrintNoModRef, I, Pointer,
|
||||
F.getParent());
|
||||
++NoModRefCount;
|
||||
break;
|
||||
case MRI_Mod:
|
||||
PrintModRefResults("Just Mod", PrintMod, I, *V, F.getParent());
|
||||
PrintModRefResults("Just Mod", PrintMod, I, Pointer, F.getParent());
|
||||
++ModCount;
|
||||
break;
|
||||
case MRI_Ref:
|
||||
PrintModRefResults("Just Ref", PrintRef, I, *V, F.getParent());
|
||||
PrintModRefResults("Just Ref", PrintRef, I, Pointer, F.getParent());
|
||||
++RefCount;
|
||||
break;
|
||||
case MRI_ModRef:
|
||||
PrintModRefResults("Both ModRef", PrintModRef, I, *V, F.getParent());
|
||||
PrintModRefResults("Both ModRef", PrintModRef, I, Pointer,
|
||||
F.getParent());
|
||||
++ModRefCount;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -234,15 +234,15 @@ AliasSet *AliasSetTracker::mergeAliasSetsForPointer(const Value *Ptr,
|
|||
/// alias sets.
|
||||
bool AliasSetTracker::containsPointer(const Value *Ptr, uint64_t Size,
|
||||
const AAMDNodes &AAInfo) const {
|
||||
for (const_iterator I = begin(), E = end(); I != E; ++I)
|
||||
if (!I->Forward && I->aliasesPointer(Ptr, Size, AAInfo, AA))
|
||||
for (const AliasSet &AS : *this)
|
||||
if (!AS.Forward && AS.aliasesPointer(Ptr, Size, AAInfo, AA))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AliasSetTracker::containsUnknown(const Instruction *Inst) const {
|
||||
for (const_iterator I = begin(), E = end(); I != E; ++I)
|
||||
if (!I->Forward && I->aliasesUnknownInst(Inst, AA))
|
||||
for (const AliasSet &AS : *this)
|
||||
if (!AS.Forward && AS.aliasesUnknownInst(Inst, AA))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -409,10 +409,9 @@ void AliasSetTracker::add(const AliasSetTracker &AST) {
|
|||
// Loop over all of the alias sets in AST, adding the pointers contained
|
||||
// therein into the current alias sets. This can cause alias sets to be
|
||||
// merged together in the current AST.
|
||||
for (const_iterator I = AST.begin(), E = AST.end(); I != E; ++I) {
|
||||
if (I->Forward) continue; // Ignore forwarding alias sets
|
||||
|
||||
AliasSet &AS = const_cast<AliasSet&>(*I);
|
||||
for (const AliasSet &AS : AST) {
|
||||
if (AS.Forward)
|
||||
continue; // Ignore forwarding alias sets
|
||||
|
||||
// If there are any call sites in the alias set, add them to this AST.
|
||||
for (unsigned i = 0, e = AS.UnknownInsts.size(); i != e; ++i)
|
||||
|
@ -648,8 +647,8 @@ void AliasSet::print(raw_ostream &OS) const {
|
|||
void AliasSetTracker::print(raw_ostream &OS) const {
|
||||
OS << "Alias Set Tracker: " << AliasSets.size() << " alias sets for "
|
||||
<< PointerMap.size() << " pointer values.\n";
|
||||
for (const_iterator I = begin(), E = end(); I != E; ++I)
|
||||
I->print(OS);
|
||||
for (const AliasSet &AS : *this)
|
||||
AS.print(OS);
|
||||
OS << "\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -80,11 +80,9 @@ void CallGraph::addToCallGraph(Function *F) {
|
|||
Node->addCalledFunction(CallSite(), CallsExternalNode.get());
|
||||
|
||||
// Look for calls by this function.
|
||||
for (Function::iterator BB = F->begin(), BBE = F->end(); BB != BBE; ++BB)
|
||||
for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); II != IE;
|
||||
++II) {
|
||||
CallSite CS(cast<Value>(II));
|
||||
if (CS) {
|
||||
for (BasicBlock &BB : *F)
|
||||
for (Instruction &I : BB) {
|
||||
if (auto CS = CallSite(&I)) {
|
||||
const Function *Callee = CS.getCalledFunction();
|
||||
if (!Callee || !Intrinsic::isLeaf(Callee->getIntrinsicID()))
|
||||
// Indirect calls of intrinsics are not allowed so no need to check.
|
||||
|
@ -111,8 +109,8 @@ void CallGraph::print(raw_ostream &OS) const {
|
|||
SmallVector<CallGraphNode *, 16> Nodes;
|
||||
Nodes.reserve(FunctionMap.size());
|
||||
|
||||
for (auto I = begin(), E = end(); I != E; ++I)
|
||||
Nodes.push_back(I->second.get());
|
||||
for (const auto &I : *this)
|
||||
Nodes.push_back(I.second.get());
|
||||
|
||||
std::sort(Nodes.begin(), Nodes.end(),
|
||||
[](CallGraphNode *LHS, CallGraphNode *RHS) {
|
||||
|
@ -186,9 +184,9 @@ void CallGraphNode::print(raw_ostream &OS) const {
|
|||
|
||||
OS << "<<" << this << ">> #uses=" << getNumReferences() << '\n';
|
||||
|
||||
for (const_iterator I = begin(), E = end(); I != E; ++I) {
|
||||
OS << " CS<" << I->first << "> calls ";
|
||||
if (Function *FI = I->second->getFunction())
|
||||
for (const auto &I : *this) {
|
||||
OS << " CS<" << I.first << "> calls ";
|
||||
if (Function *FI = I.second->getFunction())
|
||||
OS << "function '" << FI->getName() <<"'\n";
|
||||
else
|
||||
OS << "external node\n";
|
||||
|
|
|
@ -261,10 +261,10 @@ bool CGPassManager::RefreshCallGraph(CallGraphSCC &CurSCC,
|
|||
// Loop over all of the instructions in the function, getting the callsites.
|
||||
// Keep track of the number of direct/indirect calls added.
|
||||
unsigned NumDirectAdded = 0, NumIndirectAdded = 0;
|
||||
|
||||
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
|
||||
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) {
|
||||
CallSite CS(cast<Value>(I));
|
||||
|
||||
for (BasicBlock &BB : *F)
|
||||
for (Instruction &I : BB) {
|
||||
CallSite CS(&I);
|
||||
if (!CS) continue;
|
||||
Function *Callee = CS.getCalledFunction();
|
||||
if (Callee && Callee->isIntrinsic()) continue;
|
||||
|
|
|
@ -522,16 +522,15 @@ void CostModelAnalysis::print(raw_ostream &OS, const Module*) const {
|
|||
if (!F)
|
||||
return;
|
||||
|
||||
for (Function::iterator B = F->begin(), BE = F->end(); B != BE; ++B) {
|
||||
for (BasicBlock::iterator it = B->begin(), e = B->end(); it != e; ++it) {
|
||||
Instruction *Inst = &*it;
|
||||
unsigned Cost = getInstructionCost(Inst);
|
||||
for (BasicBlock &B : *F) {
|
||||
for (Instruction &Inst : B) {
|
||||
unsigned Cost = getInstructionCost(&Inst);
|
||||
if (Cost != (unsigned)-1)
|
||||
OS << "Cost Model: Found an estimated cost of " << Cost;
|
||||
else
|
||||
OS << "Cost Model: Unknown cost";
|
||||
|
||||
OS << " for instruction: "<< *Inst << "\n";
|
||||
OS << " for instruction: " << Inst << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -781,9 +781,9 @@ void DependenceInfo::unifySubscriptType(ArrayRef<Subscript *> Pairs) {
|
|||
|
||||
// Go through each pair and find the widest bit to which we need
|
||||
// to extend all of them.
|
||||
for (unsigned i = 0; i < Pairs.size(); i++) {
|
||||
const SCEV *Src = Pairs[i]->Src;
|
||||
const SCEV *Dst = Pairs[i]->Dst;
|
||||
for (Subscript *Pair : Pairs) {
|
||||
const SCEV *Src = Pair->Src;
|
||||
const SCEV *Dst = Pair->Dst;
|
||||
IntegerType *SrcTy = dyn_cast<IntegerType>(Src->getType());
|
||||
IntegerType *DstTy = dyn_cast<IntegerType>(Dst->getType());
|
||||
if (SrcTy == nullptr || DstTy == nullptr) {
|
||||
|
@ -806,9 +806,9 @@ void DependenceInfo::unifySubscriptType(ArrayRef<Subscript *> Pairs) {
|
|||
assert(widestWidthSeen > 0);
|
||||
|
||||
// Now extend each pair to the widest seen.
|
||||
for (unsigned i = 0; i < Pairs.size(); i++) {
|
||||
const SCEV *Src = Pairs[i]->Src;
|
||||
const SCEV *Dst = Pairs[i]->Dst;
|
||||
for (Subscript *Pair : Pairs) {
|
||||
const SCEV *Src = Pair->Src;
|
||||
const SCEV *Dst = Pair->Dst;
|
||||
IntegerType *SrcTy = dyn_cast<IntegerType>(Src->getType());
|
||||
IntegerType *DstTy = dyn_cast<IntegerType>(Dst->getType());
|
||||
if (SrcTy == nullptr || DstTy == nullptr) {
|
||||
|
@ -819,10 +819,10 @@ void DependenceInfo::unifySubscriptType(ArrayRef<Subscript *> Pairs) {
|
|||
}
|
||||
if (SrcTy->getBitWidth() < widestWidthSeen)
|
||||
// Sign-extend Src to widestType
|
||||
Pairs[i]->Src = SE->getSignExtendExpr(Src, widestType);
|
||||
Pair->Src = SE->getSignExtendExpr(Src, widestType);
|
||||
if (DstTy->getBitWidth() < widestWidthSeen) {
|
||||
// Sign-extend Dst to widestType
|
||||
Pairs[i]->Dst = SE->getSignExtendExpr(Dst, widestType);
|
||||
Pair->Dst = SE->getSignExtendExpr(Dst, widestType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -290,21 +290,18 @@ void IVUsers::print(raw_ostream &OS, const Module *M) const {
|
|||
}
|
||||
OS << ":\n";
|
||||
|
||||
for (ilist<IVStrideUse>::const_iterator UI = IVUses.begin(),
|
||||
E = IVUses.end(); UI != E; ++UI) {
|
||||
for (const IVStrideUse &IVUse : IVUses) {
|
||||
OS << " ";
|
||||
UI->getOperandValToReplace()->printAsOperand(OS, false);
|
||||
OS << " = " << *getReplacementExpr(*UI);
|
||||
for (PostIncLoopSet::const_iterator
|
||||
I = UI->PostIncLoops.begin(),
|
||||
E = UI->PostIncLoops.end(); I != E; ++I) {
|
||||
IVUse.getOperandValToReplace()->printAsOperand(OS, false);
|
||||
OS << " = " << *getReplacementExpr(IVUse);
|
||||
for (auto PostIncLoop : IVUse.PostIncLoops) {
|
||||
OS << " (post-inc with loop ";
|
||||
(*I)->getHeader()->printAsOperand(OS, false);
|
||||
PostIncLoop->getHeader()->printAsOperand(OS, false);
|
||||
OS << ")";
|
||||
}
|
||||
OS << " in ";
|
||||
if (UI->getUser())
|
||||
UI->getUser()->print(OS);
|
||||
if (IVUse.getUser())
|
||||
IVUse.getUser()->print(OS);
|
||||
else
|
||||
OS << "Printing <null> User";
|
||||
OS << '\n';
|
||||
|
|
|
@ -42,17 +42,14 @@ void Interval::print(raw_ostream &OS) const {
|
|||
<< "Interval Contents:\n";
|
||||
|
||||
// Print out all of the basic blocks in the interval...
|
||||
for (std::vector<BasicBlock*>::const_iterator I = Nodes.begin(),
|
||||
E = Nodes.end(); I != E; ++I)
|
||||
OS << **I << "\n";
|
||||
for (const BasicBlock *Node : Nodes)
|
||||
OS << *Node << "\n";
|
||||
|
||||
OS << "Interval Predecessors:\n";
|
||||
for (std::vector<BasicBlock*>::const_iterator I = Predecessors.begin(),
|
||||
E = Predecessors.end(); I != E; ++I)
|
||||
OS << **I << "\n";
|
||||
for (const BasicBlock *Predecessor : Predecessors)
|
||||
OS << *Predecessor << "\n";
|
||||
|
||||
OS << "Interval Successors:\n";
|
||||
for (std::vector<BasicBlock*>::const_iterator I = Successors.begin(),
|
||||
E = Successors.end(); I != E; ++I)
|
||||
OS << **I << "\n";
|
||||
for (const BasicBlock *Successor : Successors)
|
||||
OS << *Successor << "\n";
|
||||
}
|
||||
|
|
|
@ -57,9 +57,8 @@ void IntervalPartition::addIntervalToPartition(Interval *I) {
|
|||
//
|
||||
void IntervalPartition::updatePredecessors(Interval *Int) {
|
||||
BasicBlock *Header = Int->getHeaderNode();
|
||||
for (Interval::succ_iterator I = Int->Successors.begin(),
|
||||
E = Int->Successors.end(); I != E; ++I)
|
||||
getBlockInterval(*I)->Predecessors.push_back(Header);
|
||||
for (BasicBlock *Successor : Int->Successors)
|
||||
getBlockInterval(Successor)->Predecessors.push_back(Header);
|
||||
}
|
||||
|
||||
// IntervalPartition ctor - Build the first level interval partition for the
|
||||
|
|
|
@ -563,8 +563,8 @@ void LazyValueInfoCache::eraseBlock(BasicBlock *BB) {
|
|||
if (ODI != OverDefinedCache.end())
|
||||
OverDefinedCache.erase(ODI);
|
||||
|
||||
for (auto I = ValueCache.begin(), E = ValueCache.end(); I != E; ++I)
|
||||
I->second.erase(BB);
|
||||
for (auto &I : ValueCache)
|
||||
I.second.erase(BB);
|
||||
}
|
||||
|
||||
void LazyValueInfoCache::solve() {
|
||||
|
|
|
@ -434,17 +434,16 @@ void UnloopUpdater::updateBlockParents() {
|
|||
// Perform a post order CFG traversal of all blocks within this loop,
|
||||
// propagating the nearest loop from sucessors to predecessors.
|
||||
LoopBlocksTraversal Traversal(DFS, LI);
|
||||
for (LoopBlocksTraversal::POTIterator POI = Traversal.begin(),
|
||||
POE = Traversal.end(); POI != POE; ++POI) {
|
||||
for (BasicBlock *POI : Traversal) {
|
||||
|
||||
Loop *L = LI->getLoopFor(*POI);
|
||||
Loop *NL = getNearestLoop(*POI, L);
|
||||
Loop *L = LI->getLoopFor(POI);
|
||||
Loop *NL = getNearestLoop(POI, L);
|
||||
|
||||
if (NL != L) {
|
||||
// For reducible loops, NL is now an ancestor of Unloop.
|
||||
assert((NL != &Unloop && (!NL || NL->contains(&Unloop))) &&
|
||||
"uninitialized successor");
|
||||
LI->changeLoopFor(*POI, NL);
|
||||
LI->changeLoopFor(POI, NL);
|
||||
}
|
||||
else {
|
||||
// Or the current block is part of a subloop, in which case its parent
|
||||
|
|
|
@ -109,9 +109,7 @@ void LPPassManager::cloneBasicBlockSimpleAnalysis(BasicBlock *From,
|
|||
/// deleteSimpleAnalysisValue - Invoke deleteAnalysisValue hook for all passes.
|
||||
void LPPassManager::deleteSimpleAnalysisValue(Value *V, Loop *L) {
|
||||
if (BasicBlock *BB = dyn_cast<BasicBlock>(V)) {
|
||||
for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE;
|
||||
++BI) {
|
||||
Instruction &I = *BI;
|
||||
for (Instruction &I : *BB) {
|
||||
deleteSimpleAnalysisValue(&I, L);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,10 +111,9 @@ bool MemDepPrinter::runOnFunction(Function &F) {
|
|||
MDA.getNonLocalCallDependency(CS);
|
||||
|
||||
DepSet &InstDeps = Deps[Inst];
|
||||
for (MemoryDependenceResults::NonLocalDepInfo::const_iterator
|
||||
I = NLDI.begin(), E = NLDI.end(); I != E; ++I) {
|
||||
const MemDepResult &Res = I->getResult();
|
||||
InstDeps.insert(std::make_pair(getInstTypePair(Res), I->getBB()));
|
||||
for (const NonLocalDepEntry &I : NLDI) {
|
||||
const MemDepResult &Res = I.getResult();
|
||||
InstDeps.insert(std::make_pair(getInstTypePair(Res), I.getBB()));
|
||||
}
|
||||
} else {
|
||||
SmallVector<NonLocalDepResult, 4> NLDI;
|
||||
|
@ -123,10 +122,9 @@ bool MemDepPrinter::runOnFunction(Function &F) {
|
|||
MDA.getNonLocalPointerDependency(Inst, NLDI);
|
||||
|
||||
DepSet &InstDeps = Deps[Inst];
|
||||
for (SmallVectorImpl<NonLocalDepResult>::const_iterator
|
||||
I = NLDI.begin(), E = NLDI.end(); I != E; ++I) {
|
||||
const MemDepResult &Res = I->getResult();
|
||||
InstDeps.insert(std::make_pair(getInstTypePair(Res), I->getBB()));
|
||||
for (const NonLocalDepResult &I : NLDI) {
|
||||
const MemDepResult &Res = I.getResult();
|
||||
InstDeps.insert(std::make_pair(getInstTypePair(Res), I.getBB()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -661,8 +661,8 @@ SizeOffsetEvalType ObjectSizeOffsetEvaluator::compute(Value *V) {
|
|||
// erase everything that was computed in this iteration from the cache, so
|
||||
// that no dangling references are left behind. We could be a bit smarter if
|
||||
// we kept a dependency graph. It's probably not worth the complexity.
|
||||
for (PtrSetTy::iterator I=SeenVals.begin(), E=SeenVals.end(); I != E; ++I) {
|
||||
CacheMapTy::iterator CacheIt = CacheMap.find(*I);
|
||||
for (const Value *SeenVal : SeenVals) {
|
||||
CacheMapTy::iterator CacheIt = CacheMap.find(SeenVal);
|
||||
// non-computable results can be safely cached
|
||||
if (CacheIt != CacheMap.end() && anyKnown(CacheIt->second))
|
||||
CacheMap.erase(CacheIt);
|
||||
|
|
|
@ -76,24 +76,23 @@ void ModuleSummaryIndexBuilder::computeFunctionSummary(
|
|||
DenseSet<const Value *> RefEdges;
|
||||
|
||||
SmallPtrSet<const User *, 8> Visited;
|
||||
for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
|
||||
for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E;
|
||||
++I) {
|
||||
for (const BasicBlock &BB : F)
|
||||
for (const Instruction &I : BB) {
|
||||
if (!isa<DbgInfoIntrinsic>(I))
|
||||
++NumInsts;
|
||||
|
||||
if (auto CS = ImmutableCallSite(&*I)) {
|
||||
if (auto CS = ImmutableCallSite(&I)) {
|
||||
auto *CalledFunction = CS.getCalledFunction();
|
||||
if (CalledFunction && CalledFunction->hasName() &&
|
||||
!CalledFunction->isIntrinsic()) {
|
||||
auto ScaledCount = BFI ? BFI->getBlockProfileCount(&*BB) : None;
|
||||
auto ScaledCount = BFI ? BFI->getBlockProfileCount(&BB) : None;
|
||||
auto *CalleeId =
|
||||
M->getValueSymbolTable().lookup(CalledFunction->getName());
|
||||
CallGraphEdges[CalleeId] +=
|
||||
(ScaledCount ? ScaledCount.getValue() : 0);
|
||||
}
|
||||
}
|
||||
findRefEdges(&*I, RefEdges, Visited);
|
||||
findRefEdges(&I, RefEdges, Visited);
|
||||
}
|
||||
|
||||
GlobalValueSummary::GVFlags Flags(F);
|
||||
|
|
|
@ -117,8 +117,8 @@ struct DOTGraphTraits<RegionInfo *> : public DOTGraphTraits<RegionNode *> {
|
|||
<< ((R.getDepth() * 2 % 12) + 2) << "\n";
|
||||
}
|
||||
|
||||
for (Region::const_iterator RI = R.begin(), RE = R.end(); RI != RE; ++RI)
|
||||
printRegionCluster(**RI, GW, depth + 1);
|
||||
for (const auto &RI : R)
|
||||
printRegionCluster(*RI, GW, depth + 1);
|
||||
|
||||
const RegionInfo &RI = *static_cast<const RegionInfo*>(R.getRegionInfo());
|
||||
|
||||
|
|
|
@ -5485,8 +5485,8 @@ void ScalarEvolution::forgetLoop(const Loop *L) {
|
|||
|
||||
// Forget all contained loops too, to avoid dangling entries in the
|
||||
// ValuesAtScopes map.
|
||||
for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
|
||||
forgetLoop(*I);
|
||||
for (Loop *I : *L)
|
||||
forgetLoop(I);
|
||||
|
||||
LoopHasNoAbnormalExits.erase(L);
|
||||
}
|
||||
|
@ -9534,8 +9534,8 @@ bool ScalarEvolution::hasLoopInvariantBackedgeTakenCount(const Loop *L) {
|
|||
static void PrintLoopInfo(raw_ostream &OS, ScalarEvolution *SE,
|
||||
const Loop *L) {
|
||||
// Print all inner loops first
|
||||
for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
|
||||
PrintLoopInfo(OS, SE, *I);
|
||||
for (Loop *I : *L)
|
||||
PrintLoopInfo(OS, SE, I);
|
||||
|
||||
OS << "Loop ";
|
||||
L->getHeader()->printAsOperand(OS, /*PrintType=*/false);
|
||||
|
@ -9676,8 +9676,8 @@ void ScalarEvolution::print(raw_ostream &OS) const {
|
|||
OS << "Determining loop execution counts for: ";
|
||||
F.printAsOperand(OS, /*PrintType=*/false);
|
||||
OS << "\n";
|
||||
for (LoopInfo::iterator I = LI.begin(), E = LI.end(); I != E; ++I)
|
||||
PrintLoopInfo(OS, &SE, *I);
|
||||
for (Loop *I : LI)
|
||||
PrintLoopInfo(OS, &SE, I);
|
||||
}
|
||||
|
||||
ScalarEvolution::LoopDisposition
|
||||
|
@ -10429,8 +10429,8 @@ PredicatedScalarEvolution::PredicatedScalarEvolution(
|
|||
const PredicatedScalarEvolution &Init)
|
||||
: RewriteMap(Init.RewriteMap), SE(Init.SE), L(Init.L), Preds(Init.Preds),
|
||||
Generation(Init.Generation), BackedgeCount(Init.BackedgeCount) {
|
||||
for (auto I = Init.FlagsMap.begin(), E = Init.FlagsMap.end(); I != E; ++I)
|
||||
FlagsMap.insert(*I);
|
||||
for (const auto &I : Init.FlagsMap)
|
||||
FlagsMap.insert(I);
|
||||
}
|
||||
|
||||
void PredicatedScalarEvolution::print(raw_ostream &OS, unsigned Depth) const {
|
||||
|
|
|
@ -320,8 +320,8 @@ void SparseSolver::Solve(Function &F) {
|
|||
|
||||
// Notify all instructions in this basic block that they are newly
|
||||
// executable.
|
||||
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
|
||||
visitInst(*I);
|
||||
for (Instruction &I : *BB)
|
||||
visitInst(I);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue