[clang] [clang][CodeGen] `used` globals && the payloads for global ctors & dtors are globals (PR #93601)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Thu May 30 10:58:39 PDT 2024


================
@@ -1,6 +1,8 @@
 // RUN: %clang_cc1 %s -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck %s --check-prefix=GLOBALAS
 
 // CHECK: @llvm.used = appending global [2 x ptr] [ptr @foo, ptr @X], section "llvm.metadata"
+// GLOBALAS: @llvm.compiler.used = appending addrspace(1) global [2 x ptr addrspace(1)] [ptr addrspace(1) addrspacecast (ptr @foo to ptr addrspace(1)), ptr addrspace(1) @X], section "llvm.metadata"
----------------
arsenm wrote:

Used really should use flat. It happens to be better for us that we can legally cast more things to addrspace(0) than to 1, but given how the IR currently works we should just assume used is as 0 

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


More information about the cfe-commits mailing list