forked from OSchip/llvm-project
[NFC][PowerPC] Improve the for loop in Early Return
Summary: In `PPCEarlyReturn.cpp` ``` 183 for (MachineFunction::iterator I = MF.begin(); I != MF.end();) { 184 MachineBasicBlock &B = *I++; 185 if (processBlock(B)) 186 Changed = true; 187 } ``` Above code can be improved to: ``` 184 for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E;) { 185 MachineBasicBlock &B = *I++; 186 Changed |= processBlock(B); 187 } ``` Reviewed By: hfinkel Differential Revision: https://reviews.llvm.org/D63800 llvm-svn: 364496
This commit is contained in:
parent
f35a3456ea
commit
490bc46541
|
@ -179,11 +179,11 @@ public:
|
|||
// nothing to do.
|
||||
if (MF.size() < 2)
|
||||
return Changed;
|
||||
|
||||
for (MachineFunction::iterator I = MF.begin(); I != MF.end();) {
|
||||
|
||||
// We can't use a range-based for loop due to clobbering the iterator.
|
||||
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E;) {
|
||||
MachineBasicBlock &B = *I++;
|
||||
if (processBlock(B))
|
||||
Changed = true;
|
||||
Changed |= processBlock(B);
|
||||
}
|
||||
|
||||
return Changed;
|
||||
|
|
Loading…
Reference in New Issue