[PATCH][Clang Driver] Driver::IsUsingLTO no longer return true when seeing -emit-llvm

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Aug 21 20:30:37 PDT 2013


On 13 August 2013 19:20, Shuxin Yang <shuxin.llvm at gmail.com> wrote:
> Hi,
>
>     Driver::IsUsingLTO()  returns true when "-emit-llvm" is seen, which is
> quite awkward if we need to differentiate following two commands, where
> 1) is just go through regular passes and stop at llc, while 2) needs to go
> through
> pre-ipo passes.
>
>    1) clang -emit-llvm a.c -c , and
>    2) clang -flto a.c -c
>
>  With this tiny patch is to differentiate these two situations.

First of all sorry for being so late on this thread.

I am not sure what you mean by "pre-ipo passes", but yes. We need two
different options. One is a developer options for "give me the IL for
this TU as it was before codegen". The other one is "write IL to disk
so that we can do LTO". For example, one likely difference will be
being less aggressive during inlining in each TU.

I agree that we can use -emit-llvm for the dev option and -flto for
the user option.

>  However, it changes the semantic of this command:
>
>    clang -emit-llvm a.c # NOTE: no -c.
>
>  I'm wondering if this command make sense or not.

Probably not. I would suggest just producing an error if -emit-llvm is
given with anything but -S or -c.

Cheers,
Rafael



More information about the llvm-commits mailing list