[llvm] r205445 - [C++11, ARM64] Range based for loops in constant promotion.
Jim Grosbach
grosbach at apple.com
Wed Apr 2 11:00:56 PDT 2014
Author: grosbach
Date: Wed Apr 2 13:00:56 2014
New Revision: 205445
URL: http://llvm.org/viewvc/llvm-project?rev=205445&view=rev
Log:
[C++11,ARM64] Range based for loops in constant promotion.
No functional change intended.
Modified:
llvm/trunk/lib/Target/ARM64/ARM64PromoteConstant.cpp
Modified: llvm/trunk/lib/Target/ARM64/ARM64PromoteConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM64/ARM64PromoteConstant.cpp?rev=205445&r1=205444&r2=205445&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM64/ARM64PromoteConstant.cpp (original)
+++ llvm/trunk/lib/Target/ARM64/ARM64PromoteConstant.cpp Wed Apr 2 13:00:56 2014
@@ -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
bool LocalChange = false;
SmallSet<Constant *, 8> 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<Constant>(II->getOperand(OpIdx));
+ Constant *Cst = dyn_cast<Constant>(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.
More information about the llvm-commits
mailing list