[PATCH] D63800: [NFC][PowerPC] Improve the for loop in Early Return
Zhang Kang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 26 20:40:25 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL364496: [NFC][PowerPC] Improve the for loop in Early Return (authored by ZhangKang, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D63800?vs=206572&id=206778#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63800/new/
https://reviews.llvm.org/D63800
Files:
llvm/trunk/lib/Target/PowerPC/PPCEarlyReturn.cpp
Index: llvm/trunk/lib/Target/PowerPC/PPCEarlyReturn.cpp
===================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCEarlyReturn.cpp
+++ llvm/trunk/lib/Target/PowerPC/PPCEarlyReturn.cpp
@@ -179,11 +179,11 @@
// 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63800.206778.patch
Type: text/x-patch
Size: 733 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190627/aaf755a5/attachment.bin>
More information about the llvm-commits
mailing list