[llvm] c295553 - [MCA] Anchoring the vtable of CustomBehaviour

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 16 12:45:22 PDT 2021


Author: Min-Yih Hsu
Date: 2021-06-16T12:43:58-07:00
New Revision: c29555342ce18cd4769228db650dbcd817a6e474

URL: https://github.com/llvm/llvm-project/commit/c29555342ce18cd4769228db650dbcd817a6e474
DIFF: https://github.com/llvm/llvm-project/commit/c29555342ce18cd4769228db650dbcd817a6e474.diff

LOG: [MCA] Anchoring the vtable of CustomBehaviour

Put the dtor of mca::CustomBehaviour into the cpp file to avoid
undefined vtable when linking libLLVMMCACustomBehaviourAMDGPU as shared
library.

Differential Revision: https://reviews.llvm.org/D104401

Added: 
    

Modified: 
    llvm/include/llvm/MCA/CustomBehaviour.h
    llvm/lib/MCA/CustomBehaviour.cpp
    llvm/tools/llvm-mca/lib/AMDGPU/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MCA/CustomBehaviour.h b/llvm/include/llvm/MCA/CustomBehaviour.h
index 246a5debd6c32..655a9c49c5992 100644
--- a/llvm/include/llvm/MCA/CustomBehaviour.h
+++ b/llvm/include/llvm/MCA/CustomBehaviour.h
@@ -63,7 +63,7 @@ class CustomBehaviour {
                   const MCInstrInfo &MCII)
       : STI(STI), SrcMgr(SrcMgr), MCII(MCII) {}
 
-  virtual ~CustomBehaviour() {}
+  virtual ~CustomBehaviour();
 
   // Before the llvm-mca pipeline dispatches an instruction, it first checks
   // for any register or resource dependencies / hazards. If it doesn't find

diff  --git a/llvm/lib/MCA/CustomBehaviour.cpp b/llvm/lib/MCA/CustomBehaviour.cpp
index b160f4c542149..23211f4029274 100644
--- a/llvm/lib/MCA/CustomBehaviour.cpp
+++ b/llvm/lib/MCA/CustomBehaviour.cpp
@@ -16,6 +16,8 @@
 namespace llvm {
 namespace mca {
 
+CustomBehaviour::~CustomBehaviour() {}
+
 unsigned CustomBehaviour::checkCustomHazard(ArrayRef<InstRef> IssuedInst,
                                             const InstRef &IR) {
   // 0 signifies that there are no hazards that need to be waited on

diff  --git a/llvm/tools/llvm-mca/lib/AMDGPU/CMakeLists.txt b/llvm/tools/llvm-mca/lib/AMDGPU/CMakeLists.txt
index 19c3a8f2b9f36..cd6e171ac8361 100644
--- a/llvm/tools/llvm-mca/lib/AMDGPU/CMakeLists.txt
+++ b/llvm/tools/llvm-mca/lib/AMDGPU/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories(
 set(LLVM_LINK_COMPONENTS
   AMDGPU
   Core
+  MCA
   Support
   )
 


        


More information about the llvm-commits mailing list