[LLVMdev] Proposal : Function Notes

Dale Johannesen dalej at apple.com
Tue Aug 26 10:14:15 PDT 2008


On Aug 25, 2008, at 11:02 PMPDT, Nick Kledzik wrote:
> On Aug 25, 2008, at 4:03 PM, Devang Patel wrote:
>>>
>>> These seem like great default parameters for code-gen, but looking
>>> forward, if we also allowed some optimization flags to be specified
>>> at LTO time, how would they interact?
>>
>> The flags specified on the linker command line during LTO are not
>> encoded into llvm IR. However, IMO,  these linker command line flags
>> should override notes encoded in llvm IR. We may have to handle
>> special cases, but we should document linker's decision choices
>> properly.
>
> It is not clear to me which should override which.
>
> For instance, instance, if I compiled with -Os or -O3 then I am
> forcing the codegen model at compile time, and the function IR would
> have the appropriate opt-size or opt-speed note.  But if I specify
> neither at llvm-gcc time, the function IR should have neither opt-size
> or opt-speed note.   At LTO time, I could specify -Os or -O3 (or
> equivalent) and it would make sense that the optimizer would use the
> opt-size or opt-speed from each function if there, or if none, inherit
> the default optimization goal from the link line.

I think an explicit specification at LTO time should override  
whatever's in the input IR.

I suggest this rule:  whatever option was specified latest in the  
build process wins.

In practice I don't think we'll see many intentional conflicting  
specifications.  A design
goal should be to make it hard to produce them unintentionally.




More information about the llvm-dev mailing list