[llvm] b6ae90b - [lli] Register profiling support for ORC in lli

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 17:03:07 PDT 2023


Author: Frank Tetzel
Date: 2023-03-14T17:02:43-07:00
New Revision: b6ae90b86c42707c53e38c98f1ee4a59565c645b

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

LOG: [lli] Register profiling support for ORC in lli

Adds perf event listeners when RTDyldObjectLinkingLayer is used in -jit-kind=orc
mode.

Reviewed By: lhames

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

Added: 
    

Modified: 
    llvm/tools/lli/lli.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index 808ec88d1c2f4..ff73ac18f5eee 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -946,9 +946,22 @@ int runOrcJIT(const char *ProgName) {
   auto J = ExitOnErr(Builder.create());
 
   auto *ObjLayer = &J->getObjLinkingLayer();
-  if (auto *RTDyldObjLayer = dyn_cast<orc::RTDyldObjectLinkingLayer>(ObjLayer))
+  if (auto *RTDyldObjLayer = dyn_cast<orc::RTDyldObjectLinkingLayer>(ObjLayer)) {
     RTDyldObjLayer->registerJITEventListener(
         *JITEventListener::createGDBRegistrationListener());
+#if LLVM_USE_OPROFILE
+    RTDyldObjLayer->registerJITEventListener(
+        *JITEventListener::createOProfileJITEventListener());
+#endif
+#if LLVM_USE_INTEL_JITEVENTS
+    RTDyldObjLayer->registerJITEventListener(
+        *JITEventListener::createIntelJITEventListener());
+#endif
+#if LLVM_USE_PERF
+    RTDyldObjLayer->registerJITEventListener(
+        *JITEventListener::createPerfJITEventListener());
+#endif
+  }
 
   if (PerModuleLazy)
     J->setPartitionFunction(orc::CompileOnDemandLayer::compileWholeModule);


        


More information about the llvm-commits mailing list