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

Gordon Henriksen gordonhenriksen at mac.com
Wed May 28 12:17:07 PDT 2008


On 2008-05-23, at 18:27, Chris Lattner wrote:

> What I'm getting at with this, is that if we compiled foo to include  
> an attribute "sign_ext_from_i8" or something, then we could capture  
> this information.  It would be ugly, but acceptable to define:
>
>   sign_ext_from_i8, sign_ext_from_i16
>   zero_ext_from_i8, zero_ext_from_i16
>
> And have the C front-end generate these.  Given this, the optimizer  
> and codegen can continue doing their optimizations, and we can  
> eventually eliminate the existing sext/zext attributes.


Although at some greater memory expense, maybe this could be  
generalized to a known bit mask and known bit values (for zext) and  
number of sign bits (for sext). Could probably be abbreviated fairly  
efficient in bitcode, though.

Seems to fall into a recurring pattern of memoizing analysis results  
as attributes on IR.

— Gordon





More information about the llvm-dev mailing list