From aa2091505f6de0ababf8a6ec54e8a26c8b0be2be Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 26 Jun 2016 17:27:42 +0000 Subject: Apply clang-tidy's modernize-loop-convert to lib/Analysis. Only minor manual fixes. No functionality change intended. llvm-svn: 273816 --- llvm/lib/Analysis/CostModel.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'llvm/lib/Analysis/CostModel.cpp') diff --git a/llvm/lib/Analysis/CostModel.cpp b/llvm/lib/Analysis/CostModel.cpp index 36a1db664e1..68a4bea96ba 100644 --- a/llvm/lib/Analysis/CostModel.cpp +++ b/llvm/lib/Analysis/CostModel.cpp @@ -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"; } } } -- cgit v1.2.3