================
@@ -31,3 +32,30 @@ Foo global;
 
 // WASM: define internal void @__cxx_global_array_dtor(ptr noundef %0)
 // WASM: %call = call noundef ptr @_ZN3FooD1Ev(ptr {{[^,]*}} @global)
+
+// The same holds for temporaries that are lifetime-extended by a reference 
with
+// static storage duration.
+const Foo &global_ref = Foo();
+
+// X86: define internal void @__cxx_global_var_init.1()
+// X86:   call i32 @__cxa_atexit(ptr @_ZN3FooD1Ev, ptr @_ZGR10global_ref_, ptr 
@__dso_handle)
+
+// ARM: define internal void @__cxx_global_var_init.1()
+// ARM:   call i32 @__cxa_atexit(ptr @_ZN3FooD1Ev, ptr @_ZGR10global_ref_, ptr 
@__dso_handle)
+
+// WASM: define internal void @__cxx_global_var_init.1()
+// WASM: call i32 @__cxa_atexit(ptr 
@[[REF_DTOR:__cxx_global_array_dtor[.0-9]*]], ptr null, ptr @__dso_handle)
+
+// WASM: define internal void @[[REF_DTOR]](ptr noundef %0)
+// WASM: %call = call noundef ptr @_ZN3FooD1Ev(ptr {{[^,]*}} 
@_ZGR10global_ref_)
+
+// Thread-local ones are registered with `__cxa_thread_atexit`, even with
+// `-fno-use-cxa-atexit`.
+#ifdef TLS
----------------
RobinTF wrote:

So you would recommend just dropping it? No problem!

https://github.com/llvm/llvm-project/pull/226619
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to