Skip to content

Commit 3a5f579

Browse files
author
Justin Lebar
committedJan 23, 2016
[CUDA] Die gracefully when trying to output an LLVM alias.
Summary: Previously, we would just output "foo = bar" in the assembly, and then ptxas would choke. Now we die before emitting any invalid code. Reviewers: echristo Subscribers: jholewinski, llvm-commits, jhen, tra Differential Revision: http://reviews.llvm.org/D16490 llvm-svn: 258638
1 parent 2a161f9 commit 3a5f579

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
 

‎llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,11 @@ bool NVPTXAsmPrinter::doInitialization(Module &M) {
812812
const NVPTXTargetMachine &NTM = static_cast<const NVPTXTargetMachine &>(TM);
813813
const NVPTXSubtarget STI(TT, CPU, FS, NTM);
814814

815+
if (M.alias_size()) {
816+
report_fatal_error("Module has aliases, which NVPTX does not support.");
817+
return true; // error
818+
}
819+
815820
SmallString<128> Str1;
816821
raw_svector_ostream OS1(Str1);
817822

‎llvm/test/CodeGen/NVPTX/alias.ll

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
; RUN: not llc < %s -march=nvptx -mcpu=sm_20 2>&1 | FileCheck %s
2+
3+
; Check that llc dies gracefully when given an alias.
4+
5+
define i32 @a() { ret i32 0 }
6+
; CHECK: ERROR: Module has aliases
7+
@b = internal alias i32 (), i32 ()* @a

0 commit comments

Comments
 (0)
Please sign in to comment.