================
@@ -0,0 +1,103 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --check-globals all --version 6
+// REQUIRES: amdgpu-registered-target
+
+// RUN: %clang_cc1 -fopenmp -x c -triple x86_64-unknown-unknown 
-fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -fopenmp -x c -triple x86_64-unknown-unknown 
-fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -o - | FileCheck %s 
--check-prefix=HOST
+// RUN: %clang_cc1 -fopenmp -x c -triple amdgcn-amd-amdhsa 
-fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-target-device 
-fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s 
--check-prefix=DEVICE
+
+//.
+// HOST: @__One_var = global i32 1, align 4
+// HOST: @__Two_var = global i32 2, align 4
+// HOST: @__Three_var = global i32 3, align 4
+// HOST: @.offloading.entry_name = internal unnamed_addr constant [10 x i8] 
c"__Two_var\00", section ".llvm.rodata.offloading", align 1
+// HOST: @.offloading.entry.__Two_var = weak constant 
%struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @__Two_var, ptr 
@.offloading.entry_name, i64 4, i64 0, ptr null }, section 
"llvm_offload_entries", align 8
+// HOST: @.offloading.entry_name.1 = internal unnamed_addr constant [12 x i8] 
c"__Three_var\00", section ".llvm.rodata.offloading", align 1
+// HOST: @.offloading.entry.__Three_var = weak constant 
%struct.__tgt_offload_entry { i64 0, i16 1, i16 1, i32 0, ptr @__Three_var, ptr 
@.offloading.entry_name.1, i64 4, i64 0, ptr null }, section 
"llvm_offload_entries", align 8
+// HOST: @One = weak alias i32 (), ptr @__One
+// HOST: @One_ = alias i32 (), ptr @__One
+// HOST: @One_var = weak alias i32, ptr @__One_var
+// HOST: @One_var_ = alias i32, ptr @__One_var
+// HOST: @Two = weak alias i32 (), ptr @__Two
+// HOST: @Two_ = alias i32 (), ptr @__Two
+// HOST: @Two_var = weak alias i32, ptr @__Two_var
+// HOST: @Two_var_ = alias i32, ptr @__Two_var
+// HOST: @Three = weak alias i32 (), ptr @__Three
+// HOST: @Three_ = alias i32 (), ptr @__Three
+// HOST: @Three_var = weak alias i32, ptr @__Three_var
+// HOST: @Three_var_ = alias i32, ptr @__Three_var
+//.
+// DEVICE: @__Two_var = addrspace(1) global i32 2, align 4
+// DEVICE: @__Three_var = addrspace(1) global i32 3, align 4
+// DEVICE: @Two = weak hidden alias i32 (), ptr @__Two
+// DEVICE: @Two_ = hidden alias i32 (), ptr @__Two
+// DEVICE: @Two_var = weak alias i32, addrspacecast (ptr addrspace(1) 
@__Two_var to ptr)
----------------
bjope wrote:

Is this really the preferred result here? Or should the alias also have 
addrspace(1)?

Downstream we have added some error checks to verify that the addrspace matches 
for aliases. So we get errors here typically saying "error: address space of 
alias does not match aliasee". Maybe we should upstream that code. But then we 
need to include some fixes to make sure the alias is created with the correct 
addrspace.

But maybe it makes sense for amdgcn here that the alias has a different 
addrspace? If so, then I guess we need to make sure our downstream fork only 
perform the check for our target when we want the addrspace to match with the 
aliasee.

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

Reply via email to