[llvm-dev] [ORC] SimpleCompiler and module transformations

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 9 09:02:41 PST 2016


Naively, I suspect you'd have to clone it - there are some optimizations
that must be done for correctness on the IR (such as the always inlining
pass that inlines any functions that specify they /must/ be inlined).

On Wed, Nov 9, 2016 at 1:32 AM Alex Denisov via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi devs, hi Lang,
>
> I use ORC’s SimpleCompiler to compile modules into object files and it
> works just great, however I’m having an issue:
> a module gets changed a bit when I compile it (some
> transformations/optimizations applied).
> I tried to set optimization level of a TargetMachine to None, but the
> module gets changed anyway.
>
> The question is: how can I prevent a module from being modified during
> compilation?
> I can make a clone of a module, but I’m curious if there are other ways to
> achieve the same goal.
>
> More context:
>
> When I run a program I try to get object file for a module from a cache.
> If the object file exists, then I just proceed to a module analysis phase.
> If the object does not exist, then I compile the module, put object file
> into a cache, and then proceed to a module analysis phase.
> In other words:
>
>   let object = cache.getObject(module);
>   if object == null {
>     object = compile(module)
>     cache.putObject(object, module)
>   }
>   processModule(module)
>
> When I run my program two times, then I basically analyze two different
> modules, even though they are loaded from the same bitcode file.
>
> Please, let me know if more information/clarification is needed.
>
> Any hints, suggestions, and recommendations are more than welcome :)
>
> --
> AlexDenisov
> Software Engineer, http://lowlevelbits.org
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://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/20161109/5d08617f/attachment.html>


More information about the llvm-dev mailing list