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

Iain Sandoe iain at codesourcery.com
Fri Aug 23 01:49:18 PDT 2013


Hi, I've missed this thread until now ..

(having worked on driver modifications locally for an out-of-tree port)

On 22 Aug 2013, at 22:53, Shuxin Yang wrote:
> On 8/22/13 2:28 PM, Eric Christopher wrote:
>> On Thu, Aug 22, 2013 at 2:24 PM, Shuxin Yang <shuxin.llvm at gmail.com> wrote:
>>> On 8/22/13 1:52 PM, Nick Lewycky wrote:
>>> 
>>> Sorry, I totally wasn't following this thread at all. I'm assuming the goal
>>> is to clean up the flags in preparation of adding more smarts to the "we're
>>> doing LTO" case?
>>> 
>>> 80% correct.
>>> 
>>> Let us use examples to clarify the goal:
>>> 
>>>  command 1:  clang -flto a.c -c
>>>  command 2:  clang -emit-llvm a.c -c
>>>  command 3:  clang -emit-llvm a.c
>>>  command 4:  clang -O4 a.c -c
>>> 
>>> The interpretation of these commands WAS:
>>>    command 1, 2: go through the passes defined in populateModulePasses(),
>>> and emit a *.bc file.
>>>    command 3, 4: compile to a.out using LTO
>>> 
>>> 
>>>  The interpretation of these commands will be:
>>>    command 1: need to indicate we are preparing for LTO
>>>    command 2: need to indicate we are *NOT* preparing for LTO
>> Good with me, though your wording is a bit awkward. I'd have said:
>> 
>> command 1: emit bitcode and if there's any optimization then use the
>> lto pre-lto pipeline.
>> command 2: emit bitcode and if there's any optimization then just use
>> the normal pipeline
>> 
>> Do you agree?
> 
> Yes, u are right.

Please could we arrange for the output file extensions to be ".ll" and ".bc" for the case that LLVM is being emitted?

then:

  clang a.c -flto -save-temps -o a 

could produce sensible intermediate files …
… and a developer doing:

  clang a.c -emit-llvm -S

can compare IR and the asm generated from

  clang a.c -S

without renaming a file in between?

Iain





More information about the llvm-commits mailing list