[all-commits] [llvm/llvm-project] ce3485: [llvm][GlobalOpt] Remove empty atexit destructors/...

Max Winkler via All-commits all-commits at lists.llvm.org
Mon Apr 29 17:29:56 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ce3485a0cd12b45c725f008a7836e71a1d72df49
      https://github.com/llvm/llvm-project/commit/ce3485a0cd12b45c725f008a7836e71a1d72df49
  Author: Max Winkler <max.enrico.winkler at gmail.com>
  Date:   2024-04-29 (Mon, 29 Apr 2024)

  Changed paths:
    M llvm/include/llvm/Analysis/TargetLibraryInfo.def
    M llvm/lib/Transforms/IPO/GlobalOpt.cpp
    A llvm/test/Transforms/GlobalOpt/atexit-dtor.ll
    M llvm/test/tools/llvm-tli-checker/ps4-tli-check.yaml
    M llvm/unittests/Analysis/TargetLibraryInfoTest.cpp

  Log Message:
  -----------
  [llvm][GlobalOpt] Remove empty atexit destructors/handlers (#88836)

https://godbolt.org/z/frjhqMKqc for an example.

Removal of allocations due to empty `__cxa_atexit` destructor calls is
done by the following globalopt pass.
This pass currently does not look for `atexit` handlers generated for
platforms that do not use `__cxa_atexit`.
By default Win32 and AIX use `atexit`.

I don't see an easy way to only remove `atexit` calls that the compiler
generated without looking at the generated mangled name of the atexit
handler that is being registered.
However we can easily remove all `atexit` calls that register empty
handlers since it is trivial to ensure the removed call still returns
`0` which is the value for success.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list