summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM64/ARM64PromoteConstant.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2014-04-02 18:00:56 +0000
committerJim Grosbach <grosbach@apple.com>2014-04-02 18:00:56 +0000
commit05abd709f39eb35a698f17e59bd8fe44764d562e (patch)
treed4ac8023f89d45a0c19cf1633d8e6a0156a264e0 /llvm/lib/Target/ARM64/ARM64PromoteConstant.cpp
parent7dc9edeaa5ecb8e1618282de9ebd46603046a48d (diff)
downloadbcm5719-llvm-05abd709f39eb35a698f17e59bd8fe44764d562e.tar.gz
bcm5719-llvm-05abd709f39eb35a698f17e59bd8fe44764d562e.zip
[C++11,ARM64] Range based for loops in constant promotion.
No functional change intended. llvm-svn: 205445
Diffstat (limited to 'llvm/lib/Target/ARM64/ARM64PromoteConstant.cpp')
-rw-r--r--llvm/lib/Target/ARM64/ARM64PromoteConstant.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/llvm/lib/Target/ARM64/ARM64PromoteConstant.cpp b/llvm/lib/Target/ARM64/ARM64PromoteConstant.cpp
index bbc893fdab7..9fbaedb5a58 100644
--- a/llvm/lib/Target/ARM64/ARM64PromoteConstant.cpp
+++ b/llvm/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<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.
OpenPOWER on IntegriCloud