yaxunl created this revision.
yaxunl added a reviewer: rjmccall.

Patch by Greg Rodgers.
Lit test added by Yaxun Liu.


https://reviews.llvm.org/D44987

Files:
  lib/CodeGen/CodeGenModule.cpp
  test/CodeGenCUDA/alias.cu


Index: test/CodeGenCUDA/alias.cu
===================================================================
--- test/CodeGenCUDA/alias.cu
+++ test/CodeGenCUDA/alias.cu
@@ -1,8 +1,11 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: nvptx-registered-target
+// REQUIRES: amdgpu-registered-target
 
 // RUN: %clang_cc1 -fcuda-is-device -triple nvptx-nvidia-cuda -emit-llvm \
 // RUN:   -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fcuda-is-device -triple amdgcn -emit-llvm \
+// RUN:   -o - %s | FileCheck %s
 
 #include "Inputs/cuda.h"
 
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -4678,8 +4678,9 @@
 /// same translation unit.
 void CodeGenModule::EmitStaticExternCAliases() {
   // Don't do anything if we're generating CUDA device code -- the NVPTX
-  // assembly target doesn't support aliases.
-  if (Context.getTargetInfo().getTriple().isNVPTX())
+  // and AMDGCN assembly target doesn't support aliases.
+  if (Context.getTargetInfo().getTriple().isNVPTX() ||
+      (Context.getTargetInfo().getTriple().getArch() == llvm::Triple::amdgcn))
     return;
   for (auto &I : StaticExternCValues) {
     IdentifierInfo *Name = I.first;


Index: test/CodeGenCUDA/alias.cu
===================================================================
--- test/CodeGenCUDA/alias.cu
+++ test/CodeGenCUDA/alias.cu
@@ -1,8 +1,11 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: nvptx-registered-target
+// REQUIRES: amdgpu-registered-target
 
 // RUN: %clang_cc1 -fcuda-is-device -triple nvptx-nvidia-cuda -emit-llvm \
 // RUN:   -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fcuda-is-device -triple amdgcn -emit-llvm \
+// RUN:   -o - %s | FileCheck %s
 
 #include "Inputs/cuda.h"
 
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -4678,8 +4678,9 @@
 /// same translation unit.
 void CodeGenModule::EmitStaticExternCAliases() {
   // Don't do anything if we're generating CUDA device code -- the NVPTX
-  // assembly target doesn't support aliases.
-  if (Context.getTargetInfo().getTriple().isNVPTX())
+  // and AMDGCN assembly target doesn't support aliases.
+  if (Context.getTargetInfo().getTriple().isNVPTX() ||
+      (Context.getTargetInfo().getTriple().getArch() == llvm::Triple::amdgcn))
     return;
   for (auto &I : StaticExternCValues) {
     IdentifierInfo *Name = I.first;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to