summaryrefslogtreecommitdiffstats
path: root/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-01-13 19:58:01 +0000
committerdim <dim@FreeBSD.org>2016-01-13 19:58:01 +0000
commite39b9e36e5f2d2dd312004cf5f84bb382be47dcd (patch)
tree7376a0c71aad05d327e5b1dcbceb3311a10f9f29 /lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
parentff2ba393a56d9d99dcb76ceada542233db28af9a (diff)
downloadFreeBSD-src-e39b9e36e5f2d2dd312004cf5f84bb382be47dcd.zip
FreeBSD-src-e39b9e36e5f2d2dd312004cf5f84bb382be47dcd.tar.gz
Vendor import of llvm trunk r257626:
https://llvm.org/svn/llvm-project/llvm/trunk@257626
Diffstat (limited to 'lib/Target/WebAssembly/WebAssemblyRegStackify.cpp')
-rw-r--r--lib/Target/WebAssembly/WebAssemblyRegStackify.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp b/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
index 89ef5cd..537c147 100644
--- a/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
+++ b/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
@@ -147,8 +147,10 @@ bool WebAssemblyRegStackify::runOnMachineFunction(MachineFunction &MF) {
// block boundaries, and the blocks aren't ordered so the block visitation
// order isn't significant, but we may want to change this in the future.
for (MachineBasicBlock &MBB : MF) {
- for (MachineInstr &MI : reverse(MBB)) {
- MachineInstr *Insert = &MI;
+ // Don't use a range-based for loop, because we modify the list as we're
+ // iterating over it and the end iterator may change.
+ for (auto MII = MBB.rbegin(); MII != MBB.rend(); ++MII) {
+ MachineInstr *Insert = &*MII;
// Don't nest anything inside a phi.
if (Insert->getOpcode() == TargetOpcode::PHI)
break;
@@ -221,7 +223,7 @@ bool WebAssemblyRegStackify::runOnMachineFunction(MachineFunction &MF) {
Insert = Def;
}
if (AnyStackified)
- ImposeStackOrdering(&MI);
+ ImposeStackOrdering(&*MII);
}
}
OpenPOWER on IntegriCloud