Dear Rudiger,
Rüdiger Klaehn wrote:> Hello all.
>
> is it possible to use LLVM to optimize existing .NET assemblies?
>
It's in theory possible. LLVM+VMKit already does it for Java classes.
> Basically doing the following:
>
> - read in MSIL and convert into LLVM internal representation
> - perform global optimizations on LLVM internal representation
> - write out optimized MSIL using the existing LLVM backend
>
> I presume that the capability to convert MSIL into LLVM internal
> representation exists somewhere in VMKit.
>
Although I haven't worked on VMKit's .NET for a long time, and it must
surely be broken for larger programs than HelloWorld, adding the
capability should not be too hard. It was really straightforward to add
it to VMKit's JVM.
As for the state of the MSIL backend of LLVM, I don't think it's for
production use yet. Assemblies have lots of information in them and
maintaining them during the MSIL -> LLVM -> MSIL translations should be
the hard part.
Cheers,
Nicolas
> The reason I need this is the following:
>
> I have a very large C# application that is in desperate need of some
> optimization. The problem is that the microsoft C# compiler does
> almost no optimization but relies on the MS JIT compiler to do it. But
> the MS JIT compiler does not do any agressive optimization, especially
> inlining and subsequent optimizations. So the generated machine code
> is just atrocious and performance is much lower than expected.
>
> I know that optimizing on a MSIL level will somewhat alleviate the
> problem since the microsoft C++/CLR compiler does MSIL level
> optimizations and produces much faster code in some tests I have
> written. But rewriting the application in question in C++/CLR is not
> an option.
>
>
> best regards,
>
> Rüdiger Klaehn
> ------------------------------------------------------------------------
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>