[llvm-dev] Trouble with ORCv2 Tutorial

Zeke Medley via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 7 16:42:14 PDT 2019


Hi folks,

I'm working on migrating a JIT compiler from the old ORCv1 JIT APIs to
the newer ORCv2 ones and am having some trouble getting the code from
chapter 1 of the "Building a JIT" [1] tutorial working properly. I
have previously walked through the "My First Langauge" [2] tutorial
and that went smoothly using the provided JIT class, but using the one
from the JIT tutorial is giving me trouble.

Kaleidoscope builds fine using Clang and LLVM version 9, but fails on
an expression like this:

ready> fun foo(c) c;
Read function definition:
define double @foo(double %c) {
entry:
  ret double %c
}

kaleidoscope: kaleidoscope_baseline.cpp:980: void HandleDefinition():
Assertion `add_q && "HandleDefinition: Error adding a module."'
failed.
Aborted

I'm using the exact source code from the tutorials to reproduce the
problem with some tiny changes to the front end to deal with some
slight API changes introduced in the JIT tutorial where some functions
return Expected. For example, the specific place that this is failing:

            FnIR->print(errs());
            fprintf(stderr, "\n");
-           TheJIT->addModule(std::move(TheModule));
+          auto add_q = TheJIT->addModule(std::move(TheModule));
+          assert(add_q && "HandleDefinition: Error adding a module.");
            InitializeModuleAndPassManager();


I've looked at a previous thread discussing moving from ORCv1 to ORCv2
[3] and watched the "Updating ORC JIT for Concurrencyā€¯ talk by L.
Hames & B. Loggins, but am still having a little trouble getting my
head around everything without walking through a complete tutorial.
I'd appreciate any guidance that you folks have on the migration as
well as some help with this specific issue. I'm happy to share more
about the source code and build settings if that is helpful.

Thanks in advance,

Zeke

[1] https://llvm.org/docs/tutorial/BuildingAJIT1.html
[2] https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/index.html
[3] https://groups.google.com/forum/#!searchin/llvm-dev/orcv2%7Csort:date/llvm-dev/UNXf9EOw43g/w3qOKLYbAwAJ


More information about the llvm-dev mailing list