From bbdf1e0432cf2173e1080d9fe2be5e30c9cd212a Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Fri, 8 Aug 2014 08:27:44 +0000 Subject: [PATCH] AArch64: stop trying to take control of all UnknownArch triples. This short-circuited our error reporting for incorrectly specified target triples (you'd get AArch64 code instead). Should fix PR20567. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215191 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/AArch64/TargetInfo/AArch64TargetInfo.cpp | 5 +++-- test/CodeGen/AArch64/dont-take-over-the-world.ll | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 test/CodeGen/AArch64/dont-take-over-the-world.ll diff --git a/lib/Target/AArch64/TargetInfo/AArch64TargetInfo.cpp b/lib/Target/AArch64/TargetInfo/AArch64TargetInfo.cpp index 1fee256c72c..f42ecb1677d 100644 --- a/lib/Target/AArch64/TargetInfo/AArch64TargetInfo.cpp +++ b/lib/Target/AArch64/TargetInfo/AArch64TargetInfo.cpp @@ -20,8 +20,9 @@ Target TheARM64Target; extern "C" void LLVMInitializeAArch64TargetInfo() { // Now register the "arm64" name for use with "-march". We don't want it to // take possession of the Triple::aarch64 tag though. - RegisterTarget X( - TheARM64Target, "arm64", "ARM64 (little endian)"); + TargetRegistry::RegisterTarget(TheARM64Target, "arm64", + "ARM64 (little endian)", + [](Triple::ArchType) { return false; }, true); RegisterTarget Z( TheAArch64leTarget, "aarch64", "AArch64 (little endian)"); diff --git a/test/CodeGen/AArch64/dont-take-over-the-world.ll b/test/CodeGen/AArch64/dont-take-over-the-world.ll new file mode 100644 index 00000000000..d9e13b745fd --- /dev/null +++ b/test/CodeGen/AArch64/dont-take-over-the-world.ll @@ -0,0 +1,7 @@ +; RUN: not llc -mtriple=x86-64 2>&1 | FileCheck %s + +; To support "arm64" as a -march option, we need to register a second AArch64 +; target, but we have to be careful how we do that so that it doesn't become the +; target of last resort when the specified triple is completely wrong. + +; CHECK: unable to get target for 'x86-64', see --version and --triple. -- 2.34.1