[PATCH] D87484: Fix ThinLtoJit example compilation

Jeff Hemphill via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 15:08:41 PDT 2020


jthemphill created this revision.
jthemphill added reviewers: sgraenitz, lhames.
Herald added subscribers: llvm-commits, dexonsmith, steven_wu, hiraditya, inglorion.
Herald added a project: LLVM.
jthemphill requested review of this revision.

It looks like c74900ca67241bf963b7a4cfa1fae8eadf6bb8cd <https://reviews.llvm.org/rGc74900ca67241bf963b7a4cfa1fae8eadf6bb8cd> changed `IRLayer::emit()` from accepting a `MaterializationResponsibility` to accepting a `std::unique_ptr<MaterializationResponsibility>`, which broke the compilation of the `ThinLtoJIT` example: https://reviews.llvm.org/harbormaster/build/91968/

This diff updates `ThinLtoInstrumentationLayer.h` and `ThinLtoInstrumentationLayer.cpp` to accept a `std::unique_ptr<MaterializationResponsibility>` instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87484

Files:
  llvm/examples/ThinLtoJIT/ThinLtoInstrumentationLayer.cpp
  llvm/examples/ThinLtoJIT/ThinLtoInstrumentationLayer.h
  llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp


Index: llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp
===================================================================
--- llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp
+++ llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp
@@ -267,7 +267,7 @@
       llvm::hardware_concurrency(NumCompileThreads));
   ES.setDispatchMaterialization(
       [this](std::unique_ptr<MaterializationUnit> MU,
-             MaterializationResponsibility MR) {
+             std::unique_ptr<MaterializationResponsibility> MR) {
         if (IsTrivialModule(MU.get())) {
           // This should be quick and we may save a few session locks.
           MU->materialize(std::move(MR));
@@ -276,7 +276,8 @@
           // accepts llvm::unique_function to define jobs.
           auto SharedMU = std::shared_ptr<MaterializationUnit>(std::move(MU));
           auto SharedMR =
-            std::make_shared<MaterializationResponsibility>(std::move(MR));
+              std::make_shared<std::unique_ptr<MaterializationResponsibility>>(
+                  std::move(MR));
           CompileThreads->async(
               [MU = std::move(SharedMU), MR = std::move(SharedMR)]() {
                 MU->materialize(std::move(*MR));
Index: llvm/examples/ThinLtoJIT/ThinLtoInstrumentationLayer.h
===================================================================
--- llvm/examples/ThinLtoJIT/ThinLtoInstrumentationLayer.h
+++ llvm/examples/ThinLtoJIT/ThinLtoInstrumentationLayer.h
@@ -34,7 +34,8 @@

   ~ThinLtoInstrumentationLayer() override;

-  void emit(MaterializationResponsibility R, ThreadSafeModule TSM) override;
+  void emit(std::unique_ptr<MaterializationResponsibility> R,
+            ThreadSafeModule TSM) override;

   unsigned reserveDiscoveryFlags(unsigned Count);
   void registerDiscoveryFlagOwners(std::vector<GlobalValue::GUID> Guids,
Index: llvm/examples/ThinLtoJIT/ThinLtoInstrumentationLayer.cpp
===================================================================
--- llvm/examples/ThinLtoJIT/ThinLtoInstrumentationLayer.cpp
+++ llvm/examples/ThinLtoJIT/ThinLtoInstrumentationLayer.cpp
@@ -120,8 +120,8 @@
   LLVM_DEBUG(dbgs() << "Nudged " << Count << " new functions into discovery\n");
 }

-void ThinLtoInstrumentationLayer::emit(MaterializationResponsibility R,
-                                       ThreadSafeModule TSM) {
+void ThinLtoInstrumentationLayer::emit(
+    std::unique_ptr<MaterializationResponsibility> R, ThreadSafeModule TSM) {
   TSM.withModuleDo([this](Module &M) {
     std::vector<Function *> FunctionsToInstrument;



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87484.291093.patch
Type: text/x-patch
Size: 2511 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200910/be19fba8/attachment.bin>


More information about the llvm-commits mailing list