diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-06-26 12:28:59 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-06-26 12:28:59 +0000 |
commit | 135f735af149e305635ba3886065b493d5c2bf8c (patch) | |
tree | efc8ab49d69279615e3d0a3563a7d05354270bf5 /llvm/lib/Transforms/IPO/ArgumentPromotion.cpp | |
parent | ff976c99c79d7a00f1c836a57c3e7499316553c4 (diff) | |
download | bcm5719-llvm-135f735af149e305635ba3886065b493d5c2bf8c.tar.gz bcm5719-llvm-135f735af149e305635ba3886065b493d5c2bf8c.zip |
Apply clang-tidy's modernize-loop-convert to most of lib/Transforms.
Only minor manual fixes. No functionality change intended.
llvm-svn: 273808
Diffstat (limited to 'llvm/lib/Transforms/IPO/ArgumentPromotion.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/ArgumentPromotion.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp index 1599ddd2ad5..65a7f9c5af5 100644 --- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -705,12 +705,11 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F, } // Add a parameter to the function for each element passed in. - for (ScalarizeTable::iterator SI = ArgIndices.begin(), - E = ArgIndices.end(); SI != E; ++SI) { + for (const auto &ArgIndex : ArgIndices) { // not allowed to dereference ->begin() if size() is 0 Params.push_back(GetElementPtrInst::getIndexedType( cast<PointerType>(I->getType()->getScalarType())->getElementType(), - SI->second)); + ArgIndex.second)); assert(Params.back()); } @@ -805,27 +804,25 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F, // Store the Value* version of the indices in here, but declare it now // for reuse. std::vector<Value*> Ops; - for (ScalarizeTable::iterator SI = ArgIndices.begin(), - E = ArgIndices.end(); SI != E; ++SI) { + for (const auto &ArgIndex : ArgIndices) { Value *V = *AI; - LoadInst *OrigLoad = OriginalLoads[std::make_pair(&*I, SI->second)]; - if (!SI->second.empty()) { - Ops.reserve(SI->second.size()); + LoadInst *OrigLoad = + OriginalLoads[std::make_pair(&*I, ArgIndex.second)]; + if (!ArgIndex.second.empty()) { + Ops.reserve(ArgIndex.second.size()); Type *ElTy = V->getType(); - for (IndicesVector::const_iterator II = SI->second.begin(), - IE = SI->second.end(); - II != IE; ++II) { + for (unsigned long II : ArgIndex.second) { // Use i32 to index structs, and i64 for others (pointers/arrays). // This satisfies GEP constraints. Type *IdxTy = (ElTy->isStructTy() ? Type::getInt32Ty(F->getContext()) : Type::getInt64Ty(F->getContext())); - Ops.push_back(ConstantInt::get(IdxTy, *II)); + Ops.push_back(ConstantInt::get(IdxTy, II)); // Keep track of the type we're currently indexing. - ElTy = cast<CompositeType>(ElTy)->getTypeAtIndex(*II); + ElTy = cast<CompositeType>(ElTy)->getTypeAtIndex(II); } // And create a GEP to extract those indices. - V = GetElementPtrInst::Create(SI->first, V, Ops, + V = GetElementPtrInst::Create(ArgIndex.first, V, Ops, V->getName() + ".idx", Call); Ops.clear(); } |