[llvm] LowerTypeTests: Fix quadratic complexity (try 2). (PR #136053)

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 16 16:51:34 PDT 2025


================
@@ -352,6 +352,27 @@ struct ScopedSaveAliaseesAndUsed {
   std::vector<std::pair<GlobalAlias *, Function *>> FunctionAliases;
   std::vector<std::pair<GlobalIFunc *, Function *>> ResolverIFuncs;
 
+  // This function only removes functions from llvm.used and llvm.compiler.used.
+  // We cannot remove global variables because they need to follow RAUW, as
+  // they may be deleted by buildBitSetsFromGlobalVariables.
+  void collectAndEraseUsedFunctions(Module &M,
+                                    SmallVectorImpl<GlobalValue *> &Vec,
+                                    bool CompilerUsed) {
+    auto *GV = collectUsedGlobalVariables(M, Vec, CompilerUsed);
+    if (!GV)
+      return;
+    GV->eraseFromParent();
----------------
pcc wrote:

Done

https://github.com/llvm/llvm-project/pull/136053


More information about the llvm-commits mailing list