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

Mehdi Amini via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 9 09:31:05 PST 2016


> On Nov 9, 2016, at 9:02 AM, David Blaikie via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> 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).
> 

That could be solved by "pre-optimizing”. 
However that wouldn’t be enough: there are IR transformations that are done as part of the codegen (codegenprepare for instance).

Right now in LLVM there is no other safe way (that I know of) than cloning before processing a module.


— 
Mehdi

> On Wed, Nov 9, 2016 at 1:32 AM Alex Denisov via llvm-dev <llvm-dev at lists.llvm.org <mailto: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 <http://lowlevelbits.org/>
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
> _______________________________________________
> 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/d9ab26b7/attachment-0001.html>


More information about the llvm-dev mailing list