[llvm] f9089ac - CodeGenPrep: remove all copies of GEP from list if there are duplicates.

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 25 06:00:08 PDT 2021


Author: Tim Northover
Date: 2021-10-25T14:00:02+01:00
New Revision: f9089accbac128213542703256e65ec64cba17d1

URL: https://github.com/llvm/llvm-project/commit/f9089accbac128213542703256e65ec64cba17d1
DIFF: https://github.com/llvm/llvm-project/commit/f9089accbac128213542703256e65ec64cba17d1.diff

LOG: CodeGenPrep: remove all copies of GEP from list if there are duplicates.

Unfortunately ToT has changed enough from the revision where this actually
caused problems that the test no longer triggers an assertion failure.

Added: 
    

Modified: 
    llvm/lib/CodeGen/CodeGenPrepare.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 9fdee8f5e4ffd..ac4180c4c3ab4 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -659,12 +659,8 @@ void CodeGenPrepare::removeAllAssertingVHReferences(Value *V) {
     return;
 
   auto &GEPVector = VecI->second;
-  const auto &I =
-      llvm::find_if(GEPVector, [=](auto &Elt) { return Elt.first == GEP; });
-  if (I == GEPVector.end())
-    return;
+  llvm::erase_if(GEPVector, [=](auto &Elt) { return Elt.first == GEP; });
 
-  GEPVector.erase(I);
   if (GEPVector.empty())
     LargeOffsetGEPMap.erase(VecI);
 }


        


More information about the llvm-commits mailing list