[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
This commit is contained in:
Jim Grosbach 2014-04-02 18:00:56 +00:00
parent 72ca0bfa7f
commit 252303f4ad

View File

@ -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.