diff --git a/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index c842cf86ae4..ebeeedaec69 100644 --- a/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -812,6 +812,11 @@ bool NVPTXAsmPrinter::doInitialization(Module &M) { const NVPTXTargetMachine &NTM = static_cast(TM); const NVPTXSubtarget STI(TT, CPU, FS, NTM); + if (M.alias_size()) { + report_fatal_error("Module has aliases, which NVPTX does not support."); + return true; // error + } + SmallString<128> Str1; raw_svector_ostream OS1(Str1); diff --git a/test/CodeGen/NVPTX/alias.ll b/test/CodeGen/NVPTX/alias.ll new file mode 100644 index 00000000000..a2785192769 --- /dev/null +++ b/test/CodeGen/NVPTX/alias.ll @@ -0,0 +1,7 @@ +; RUN: not llc < %s -march=nvptx -mcpu=sm_20 2>&1 | FileCheck %s + +; Check that llc dies gracefully when given an alias. + +define i32 @a() { ret i32 0 } +; CHECK: ERROR: Module has aliases +@b = internal alias i32 (), i32 ()* @a