diff --git a/llvm/unittests/MC/AMDGPU/CMakeLists.txt b/llvm/unittests/MC/AMDGPU/CMakeLists.txt index be8ff572e6f7d..06ca89a72a7cd 100644 --- a/llvm/unittests/MC/AMDGPU/CMakeLists.txt +++ b/llvm/unittests/MC/AMDGPU/CMakeLists.txt @@ -1,20 +1,12 @@ -include_directories( - ${PROJECT_SOURCE_DIR}/lib/Target/AMDGPU - ${PROJECT_BINARY_DIR}/lib/Target/AMDGPU - ) - set(LLVM_LINK_COMPONENTS AMDGPUCodeGen AMDGPUDesc AMDGPUInfo - CodeGen - Core MC Support TargetParser ) -add_llvm_unittest(AMDGPUMCTests +add_llvm_unittest(AMDGPUDwarfTests DwarfRegMappings.cpp - SIProgramInfoMCExprs.cpp ) diff --git a/llvm/unittests/MC/AMDGPU/SIProgramInfoMCExprs.cpp b/llvm/unittests/MC/AMDGPU/SIProgramInfoMCExprs.cpp deleted file mode 100644 index f2161f71e6e99..0000000000000 --- a/llvm/unittests/MC/AMDGPU/SIProgramInfoMCExprs.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//===- llvm/unittests/MC/AMDGPU/SIProgramInfoMCExprs.cpp ------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "AMDGPUHSAMetadataStreamer.h" -#include "AMDGPUTargetMachine.h" -#include "GCNSubtarget.h" -#include "SIProgramInfo.h" -#include "llvm/CodeGen/MachineModuleInfo.h" -#include "llvm/MC/MCContext.h" -#include "llvm/MC/MCExpr.h" -#include "llvm/MC/MCStreamer.h" -#include "llvm/MC/MCSymbol.h" -#include "llvm/MC/MCTargetOptions.h" -#include "llvm/MC/TargetRegistry.h" -#include "llvm/Support/TargetSelect.h" -#include "llvm/Target/TargetMachine.h" -#include "gtest/gtest.h" - -using namespace llvm; - -class SIProgramInfoMCExprsTest : public testing::Test { -protected: - std::unique_ptr TM; - std::unique_ptr Ctx; - std::unique_ptr ST; - std::unique_ptr MMI; - std::unique_ptr MF; - std::unique_ptr M; - - SIProgramInfo PI; - - static void SetUpTestSuite() { - LLVMInitializeAMDGPUTargetInfo(); - LLVMInitializeAMDGPUTarget(); - LLVMInitializeAMDGPUTargetMC(); - } - - SIProgramInfoMCExprsTest() { - std::string Triple = "amdgcn-amd-amdhsa"; - std::string CPU = "gfx1010"; - std::string FS = ""; - - std::string Error; - const Target *TheTarget = TargetRegistry::lookupTarget(Triple, Error); - TargetOptions Options; - - TM.reset(static_cast(TheTarget->createTargetMachine( - Triple, CPU, FS, Options, std::nullopt, std::nullopt))); - - Ctx = std::make_unique(); - M = std::make_unique("Module", *Ctx); - M->setDataLayout(TM->createDataLayout()); - auto *FType = FunctionType::get(Type::getVoidTy(*Ctx), false); - auto *F = Function::Create(FType, GlobalValue::ExternalLinkage, "Test", *M); - MMI = std::make_unique(TM.get()); - - ST = std::make_unique(TM->getTargetTriple(), - TM->getTargetCPU(), - TM->getTargetFeatureString(), *TM); - - MF = std::make_unique(*F, *TM, *ST, 1, *MMI); - PI.reset(*MF.get()); - } -}; - -TEST_F(SIProgramInfoMCExprsTest, TestDeathHSAKernelEmit) { - MCContext &Ctx = MF->getContext(); - MCSymbol *Sym = Ctx.getOrCreateSymbol("Unknown"); - PI.ScratchSize = MCSymbolRefExpr::create(Sym, Ctx); - - auto &Func = MF->getFunction(); - Func.setCallingConv(CallingConv::AMDGPU_KERNEL); - AMDGPU::HSAMD::MetadataStreamerMsgPackV4 MD; - EXPECT_DEATH(MD.emitKernel(*MF, PI), - "could not resolve expression when required."); -} diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn index dad4f028236d8..edd8d4f1840d0 100644 --- a/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/BUILD.gn @@ -60,7 +60,6 @@ tablegen("AMDGPUGenMCPseudoLowering") { tablegen("AMDGPUGenRegisterBank") { visibility = [ ":LLVMAMDGPUCodeGen", - "MCTargetDesc", "Utils", "//llvm/unittests/MC/AMDGPU:AMDGPUMCTests", "//llvm/unittests/Target/AMDGPU:AMDGPUTests", diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/MCTargetDesc/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/MCTargetDesc/BUILD.gn index 0df55cbc08262..5ba91fcec83a0 100644 --- a/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/MCTargetDesc/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/lib/Target/AMDGPU/MCTargetDesc/BUILD.gn @@ -94,10 +94,6 @@ static_library("MCTargetDesc") { "//llvm/lib/Target/AMDGPU/TargetInfo", "//llvm/lib/Target/AMDGPU/Utils", "//llvm/lib/TargetParser", - - # AMDGPUMCExpr.cpp includes GCNSubtarget.h which after 490e348e679 - # includes the generated AMDGPUGenRegisterBank.inc file :/ - "//llvm/lib/Target/AMDGPU/:AMDGPUGenRegisterBank", ] include_dirs = [ ".." ] sources = [