[PATCH] D44987: Disable emitting static extern C aliases for amdgcn target for CUDA

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 28 10:38:31 PDT 2018


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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44987.140101.patch
Type: text/x-patch
Size: 1265 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180328/9e49b329/attachment.bin>


More information about the cfe-commits mailing list