summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortstellar <tstellar@91177308-0d34-0410-b5e6-96231b3b80d8>2012-10-03 13:39:41 +0000
committertstellar <tstellar@91177308-0d34-0410-b5e6-96231b3b80d8>2012-10-03 13:39:41 +0000
commitdf9144532f2c01f5e5873590597df8c0b17e4da7 (patch)
treed249920081e27768bc6b214e51b6706c0219aa54
parentf7999358517c2da8472808d80717a606263e2a9a (diff)
SI: Fix bug in loops where iterators may be deleted
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/R600/@165112 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/AMDGPU/SILowerFlowControl.cpp3
-rw-r--r--lib/Target/AMDGPU/SILowerLiteralConstants.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/Target/AMDGPU/SILowerFlowControl.cpp b/lib/Target/AMDGPU/SILowerFlowControl.cpp
index bf5192efe3d..7ddb1df2c59 100644
--- a/lib/Target/AMDGPU/SILowerFlowControl.cpp
+++ b/lib/Target/AMDGPU/SILowerFlowControl.cpp
@@ -106,7 +106,8 @@ bool SILowerFlowControlPass::runOnMachineFunction(MachineFunction &MF) {
BB != BB_E; ++BB) {
MachineBasicBlock &MBB = *BB;
for (MachineBasicBlock::iterator I = MBB.begin(), Next = llvm::next(I);
- I != MBB.end(); I = Next, Next = llvm::next(I)) {
+ I != MBB.end(); I = Next) {
+ Next = llvm::next(I);
MachineInstr &MI = *I;
switch (MI.getOpcode()) {
default: break;
diff --git a/lib/Target/AMDGPU/SILowerLiteralConstants.cpp b/lib/Target/AMDGPU/SILowerLiteralConstants.cpp
index 720245091f7..6f4a0d616bb 100644
--- a/lib/Target/AMDGPU/SILowerLiteralConstants.cpp
+++ b/lib/Target/AMDGPU/SILowerLiteralConstants.cpp
@@ -65,7 +65,8 @@ bool SILowerLiteralConstantsPass::runOnMachineFunction(MachineFunction &MF) {
BB != BB_E; ++BB) {
MachineBasicBlock &MBB = *BB;
for (MachineBasicBlock::iterator I = MBB.begin(), Next = llvm::next(I);
- I != MBB.end(); I = Next, Next = llvm::next(I)) {
+ I != MBB.end(); I = Next) {
+ Next = llvm::next(I);
MachineInstr &MI = *I;
switch (MI.getOpcode()) {
default: break;