[llvm] Utils: Preserve address space for global_ctors (PR #112532)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 22:25:15 PDT 2024


================
@@ -0,0 +1,19 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 5
+; RUN: opt -S -passes=globalopt < %s | FileCheck %s
+
+; Make sure the address space of global_ctors is preserved
+
+%ini = type { i32, ptr, ptr }
+
+ at llvm.global_ctors = appending addrspace(1) global [1 x %ini] [%ini { i32 65534, ptr @ctor1, ptr null }]
+
+;.
+; CHECK: @llvm.global_ctors = appending addrspace(1) global [0 x %ini] zeroinitializer
----------------
shiltian wrote:

Why does it become `[0 x %ini]` afterwards?

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


More information about the llvm-commits mailing list