[llvm] r371761 - AMDGPU: Fix bug in r371671 on some builds.

Austin Kerbow via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 12 12:12:21 PDT 2019


Author: kerbowa
Date: Thu Sep 12 12:12:21 2019
New Revision: 371761

URL: http://llvm.org/viewvc/llvm-project?rev=371761&view=rev
Log:
AMDGPU: Fix bug in r371671 on some builds.

Modified:
    llvm/trunk/lib/Target/AMDGPU/SIFixSGPRCopies.cpp

Modified: llvm/trunk/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIFixSGPRCopies.cpp?rev=371761&r1=371760&r2=371761&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIFixSGPRCopies.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIFixSGPRCopies.cpp Thu Sep 12 12:12:21 2019
@@ -589,11 +589,14 @@ static bool hoistAndMergeSGPRInits(unsig
   // 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.




More information about the llvm-commits mailing list