[llvm-commits] [PATCH] KNRPromotion fix when FLOAT_TYPE_SIZE is not smaller than DOUBLE_TYPE_SIZE

Mikael Lepistö mikael.lepisto at tut.fi
Thu Jun 11 00:02:55 PDT 2009


Duncan Sands wrote:
> Hi Mikael,
>
>   
>> I found out that
>>
>> void function(value)
>> float value; {}
>>
>> generated following bitcode
>>
>> define void @function(double %value1)
>>
>> In IRC channel this was though to be correct for platforms where 
>> DOUBLE_TYPE_SIZE is bigger than float size e.g. x86. However in our 
>> tce-llvm-gcc cross-compiler DOUBLE_TYPE_SIZE is set to be 32 bits as 
>> FLOAT_TYPE_SIZE. So in this case correct bitcode should have been
>>
>> define void @function(float %value1)
>>
>> So here's patch attached for fixing the problem.
>>     
>
> I think something like this would be better:
>
> if (type == float_type_node)
>    LLVMTy = ConvertType(double_type_node);
>
>
> That's because float_type_node and double_type_node correspond
> to the C float/double types, while LLVM's FloatTy and DoubleTy
> need not: they correspond to a particular size.  You might need
> to look at the main type variant though.
>
> Ciao,
>
> Duncan.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>   

Thanks for the comments. Here is updated patch.

Mikael Lepistö
-------------- next part --------------
A non-text attachment was scrubbed...
Name: KNRPromotion_when_double_is_same_size_with_float-rc1.patch
Type: text/x-diff
Size: 654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090611/3debd3d3/attachment.patch>


More information about the llvm-commits mailing list