[LLVMdev] Troubling promotion of return value to Integer ...

Dan Gohman gohman at apple.com
Fri May 30 18:27:32 PDT 2008


On May 30, 2008, at 12:45 AM, Matthijs Kooijman wrote:

> Hi,
>
>> 4) There will be 4 new function attributes:
>>   sign_ext_from_i8, sign_ext_from_i16
>>   zero_ext_from_i8, zero_ext_from_i16
>>   These attributes will be placed on the function CALL node by  
>> front-end to
>>   inform the backend about such promotions and enable optimization of
>>   return value. This should be sufficient for direct and indirect  
>> call.
>>   (syntax of these attributes to be defined)
> How will these attributes work with functions returning multiple  
> values? AFAIK
> it is currently not possible to have seperate attributes for each of  
> the
> return values (since multiple return values are actually one struct).
>
> Even though our C frontends will probably not be generated functions  
> that
> return multiple values, a later optimization pass might introduce  
> extra return
> values. In this case, can these attributes be preserved in some way,  
> or
> perhaps just thrown away (causing only slower code, not  
> miscompilation)?

The above proposed attributes can be thrown away without loss of
correctness; the only issue would be the minor optimizations they
enable.

I don't know of any planned solutions for this. But as you observed,
C and other common front-ends won't need it, and we don't currently
have any optimizations that add return values.

Dan




More information about the llvm-dev mailing list