[LLVMdev] Disable optimization

RAAD B raad_7007 at yahoo.com
Fri Nov 28 00:36:44 PST 2008

Hi Eli,

I want to disable optimizations because, i'm going to implement a framework in JAVA for educational purposes.

I have planned to do followings:

    1) Create LLVM-IR and export it as Assembly (without optimizing the source-code)
2) Transform the LLVM-Assembly to a data-structure, similar to LLVM
data structure (Module, Function, BB ...) but implemented in Java
    3) Optimizing the code  (should be performed by students :-)  )
    4) Transform my data-structure to LLVM-Assembly.
    5) Generate machine code using "llvm-as"

Could you list me the other optimizations, which are performed by front-end?


From: Eli Friedman <eli.friedman at gmail.com>
To: LLVM Developers Mailing List <llvmdev at cs.uiuc.edu>
Sent: Thursday, November 27, 2008 10:39:21 PM
Subject: Re: [LLVMdev] Disable optimization

On Thu, Nov 27, 2008 at 6:14 AM, RAAD B <raad_7007 at yahoo.com> wrote:
> Hello together,
> although i use the "-O0" flag as follow, the llvm perform dead code
> elimination.
> How can i disable optimizing completely?

Sorry, it's not possible; the gcc front-end does some optimizations
which the LLVM backend can't do anything about, and dead code
elimination can arise naturally out of the approach LLVM uses for code
generation.  Note that -O0 really means "generate code as quickly as
possible, and don't do any optimizations which reduce the quality of
debug symbols".

Why exactly do you want to disable dead code elimination anyway?  I
can't see any reason why you'd want dead code in the generated
program, unless you're abusing asm statements or something like that.

LLVM Developers mailing list
LLVMdev at cs.uiuc.edu        http://llvm.cs.uiuc.edu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20081128/3125f698/attachment.html>

More information about the llvm-dev mailing list