[LLVMdev] Disable optimization

Eli Friedman eli.friedman at gmail.com
Thu Nov 27 13:39:21 PST 2008

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.


More information about the llvm-dev mailing list