[llvm] [llvm][GlobalOpt] Remove empty atexit destructors/handlers (PR #88836)

Max Winkler via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 25 17:21:33 PDT 2024


================
@@ -0,0 +1,46 @@
+; RUN: opt < %s -S -passes='cgscc(inline),function(early-cse),globalopt' | FileCheck %s
----------------
MaxEW707 wrote:

Done. Let me know if the changes are satisfactory.

Do note that I based my unit test off of, https://github.com/llvm/llvm-project/blob/main/llvm/test/Transforms/GlobalOpt/cxx-dtor.ll, which replicates the ir that the frontend generates for registering static objects with atexit.
This is why the `cgscc(inline)` pass was needed originally.

This pass assumes that other passes simplified the code enough as commented here, https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/IPO/GlobalOpt.cpp#L2351.

I am not familiar enough to know if unit testing such pass dependencies in unit tests is expected or if the unit test should be written as if other passes already simplified the ir.
I'll defer to your judgment there.

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


More information about the llvm-commits mailing list