[llvm-dev] Trouble with ORCv2 Tutorial

Praveen Velliengiri via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 7 20:38:45 PDT 2019


Hi Zeke,
Bool conversion of Error returns True for Failure States and False for
Success States.

assert(add_q && "HandleDefinition: Error adding a module."); - You're
essentially checking against success state to assert the condition. Plus,
Error have many handling APIs dealing with success and failure states, you
can use them instead of assert.
That will trigger a runtime error if Error is not handled correctly with
the reason.

Try this:
+assert(!add_q && "Handle Definition : Error Adding a Module");

Please let me know, if you ran any more problems with ORCV2.

Cheers!


On Thu, 8 Aug 2019 at 05:12, Zeke Medley via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> 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
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190808/8b7e2e9e/attachment.html>


More information about the llvm-dev mailing list