From: Jim Grosbach Date: Wed, 2 Apr 2014 18:00:56 +0000 (+0000) Subject: [C++11,ARM64] Range based for loops in constant promotion. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=252303f4ade7ebbc08d21a86400096cdd47373bd;p=oota-llvm.git [C++11,ARM64] Range based for loops in constant promotion. No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205445 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM64/ARM64PromoteConstant.cpp b/lib/Target/ARM64/ARM64PromoteConstant.cpp index bbc893fdab7..9fbaedb5a58 100644 --- a/lib/Target/ARM64/ARM64PromoteConstant.cpp +++ b/lib/Target/ARM64/ARM64PromoteConstant.cpp @@ -93,9 +93,8 @@ public: bool runOnModule(Module &M) { DEBUG(dbgs() << getPassName() << '\n'); bool Changed = false; - for (Module::iterator IFn = M.begin(), IEndFn = M.end(); IFn != IEndFn; - ++IFn) { - Changed |= runOnFunction(*IFn); + for (auto &MF: M) { + Changed |= runOnFunction(MF); } return Changed; } @@ -566,15 +565,13 @@ bool ARM64PromoteConstant::runOnFunction(Function &F) { bool LocalChange = false; SmallSet AlreadyChecked; - for (Function::iterator IBB = F.begin(), IEndBB = F.end(); IBB != IEndBB; - ++IBB) { - for (BasicBlock::iterator II = IBB->begin(), IEndI = IBB->end(); - II != IEndI; ++II) { + for (auto &MBB : F) { + for (auto &MI: MBB) { // Traverse the operand, looking for constant vectors // Replace them by a load of a global variable of type constant vector - for (unsigned OpIdx = 0, EndOpIdx = II->getNumOperands(); + for (unsigned OpIdx = 0, EndOpIdx = MI.getNumOperands(); OpIdx != EndOpIdx; ++OpIdx) { - Constant *Cst = dyn_cast(II->getOperand(OpIdx)); + Constant *Cst = dyn_cast(MI.getOperand(OpIdx)); // There is no point is promoting global value, they are already global. // Do not promote constant expression, as they may require some code // expansion.