[LLVMdev] Does the gcc frontend do inlining or deadcode elimination ?

John Criswell criswell at cs.uiuc.edu
Thu Jul 7 14:09:15 PDT 2005


Long Fei wrote:
> 
> I am investigating some inlining issue, so I did
> 
> llvm-gcc aaa.c bbb.c ... nnn.c -o output
> opt -inline -inline-threshold=xxx < output.bc | llc -march=c > 
> output_inline.c

I am unsure of whether the LLVM GCC frontend does any inlining. 
However, I do know that your methods above run the LLVM inlining pass, 
albeit indirectly.

If you use llvm-gcc to generate and link LLVM bytecode files (as you do 
in the example above), llvm-gcc runs gccas and gccld (the optimizing 
assembler and optimizing linker, respectively).  Both gccas and gccld 
run various LLVM optimizations, including inlining.  This allows 
llvm-gcc to automatically perform interprocedural optimizations.

To get a completely unoptimized bytecode file, do the following:

llvm-gcc aaa.c bbb.c ... nnn.c -Wa,-disable-opt -Wl,-disable-opt -o output

That should disable all LLVM optimizations.

-- John T.

> 
> 1)
> I noticed that even if I set xxx to 0 or even a very small negative 
> number, many functions are eliminated. I am wondering if these functions 
> are inlined by the frontend, or identified as deadcode.
> 
> For instance, SPEC2k bzip2 has 79 functions, after these two steps, only 
> 61 functions are left. no other optimizations are used.
> 
> 2)
> I noticed that the inlining condition (in 
> Transforms/IPO/InlineSimple.cpp) is tested during llvm-gcc but not 
> during the opt phase ? Can anybody explain what happens during llvm-gcc 
> and opt respectively ?
> 
> 
> thanks,
> --Long
> 
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev


-- 
John T. Criswell
Research Programmer
University of Illinois at Urbana-Champaign
"It's today!" said Piglet. "My favorite day," said Pooh.




More information about the llvm-dev mailing list