Skip to content

Commit cf321f4

Browse files
committed
AMDGPU: Fix bug in r371671 on some builds.
llvm-svn: 371761
1 parent 7264942 commit cf321f4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,11 +589,14 @@ static bool hoistAndMergeSGPRInits(unsigned Reg,
589589
// Remove initializations that were merged into another.
590590
for (auto &Init : Inits) {
591591
auto &Defs = Init.second;
592-
for (auto I = Defs.begin(); I != Defs.end(); ++I)
592+
auto I = Defs.begin();
593+
while (I != Defs.end()) {
593594
if (MergedInstrs.count(*I)) {
594595
(*I)->eraseFromParent();
595596
I = Defs.erase(I);
596-
}
597+
} else
598+
++I;
599+
}
597600
}
598601

599602
// Try to schedule SGPR initializations as early as possible in the MBB.

0 commit comments

Comments
 (0)