[llvm] [llvm][GlobalOpt] Remove empty atexit destructors/handlers (PR #88836)
    Nikita Popov via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Apr 24 20:11:17 PDT 2024
    
    
  
================
@@ -2321,14 +2322,16 @@ OptimizeGlobalAliases(Module &M,
 }
 
 static Function *
-FindCXAAtExit(Module &M, function_ref<TargetLibraryInfo &(Function &)> GetTLI) {
+FindAtExitLibFunc(Module &M,
+                  function_ref<TargetLibraryInfo &(Function &)> GetTLI,
+                  LibFunc Func) {
   // Hack to get a default TLI before we have actual Function.
   auto FuncIter = M.begin();
   if (FuncIter == M.end())
     return nullptr;
   auto *TLI = &GetTLI(*FuncIter);
 
-  LibFunc F = LibFunc_cxa_atexit;
+  LibFunc F = Func;
   if (!TLI->has(F))
----------------
nikic wrote:
```suggestion
  if (!TLI->has(Func))
```
and then declare `LibFunc F;` directly before the getLibFunc() call below, without initialization.
https://github.com/llvm/llvm-project/pull/88836
    
    
More information about the llvm-commits
mailing list