]> granicus.if.org Git - llvm/commitdiff
AMDGPU: Fix bug in r371671 on some builds.
authorAustin Kerbow <Austin.Kerbow@amd.com>
Thu, 12 Sep 2019 19:12:21 +0000 (19:12 +0000)
committerAustin Kerbow <Austin.Kerbow@amd.com>
Thu, 12 Sep 2019 19:12:21 +0000 (19:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371761 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/SIFixSGPRCopies.cpp

index 1e95cee7bf815d5c75a630cc4c066fda4d8ae81c..dad9fedff25fb546a3826df4723c3900aac432c4 100644 (file)
@@ -589,11 +589,14 @@ static bool hoistAndMergeSGPRInits(unsigned Reg,
   // Remove initializations that were merged into another.
   for (auto &Init : Inits) {
     auto &Defs = Init.second;
-    for (auto I = Defs.begin(); I != Defs.end(); ++I)
+    auto I = Defs.begin();
+    while (I != Defs.end()) {
       if (MergedInstrs.count(*I)) {
         (*I)->eraseFromParent();
         I = Defs.erase(I);
-      }
+      } else
+        ++I;
+    }
   }
 
   // Try to schedule SGPR initializations as early as possible in the MBB.