[PATCH] Avoid conversion to float when creating ConstantDataArray/ConstantDataVector

Rafael Espíndola rafael.espindola at gmail.com
Thu Feb 19 08:10:49 PST 2015


r229864.

Thanks.

On 19 February 2015 at 04:05, Raoux, Thomas F <thomas.f.raoux at intel.com> wrote:
> Sorry about that, not sure how I missed that build break.
>
> Attached is the updated patch, I tripled check that it compiles and ran clang-format on it.
>
> Cheers,
> Thomas
>
> -----Original Message-----
> From: Rafael Espíndola [mailto:rafael.espindola at gmail.com]
> Sent: Wednesday, February 18, 2015 1:33 PM
> To: Raoux, Thomas F
> Cc: Nick Lewycky; llvm-commits at cs.uiuc.edu
> Subject: Re: [PATCH] Avoid conversion to float when creating ConstantDataArray/ConstantDataVector
>
> The patch doesn't compile for me:
> /home/espindola/llvm/llvm/lib/IR/Constants.cpp:943:61: error: function definition is not allowed here
>                                                bool Packed) {
>
> Looks like it also needs to be clang-formated (you can use git-clang-format for that).
>
> Cheers,
> Rafael
>
>
> On 17 February 2015 at 16:17, Raoux, Thomas F <thomas.f.raoux at intel.com> wrote:
>> Could someone help commit this patch?
>>
>> -----Original Message-----
>> From: Raoux, Thomas F
>> Sent: Tuesday, February 10, 2015 9:45 PM
>> To: Nick Lewycky
>> Cc: 'llvm-commits at cs.uiuc.edu'; Rafael Espíndola
>> Subject: RE: [PATCH] Avoid conversion to float when creating
>> ConstantDataArray/ConstantDataVector
>>
>> Hi Nick,
>>
>>>Please give getFP its own group with its own doxygen comment describing the conversion, and maybe mention that float and double are defined in LangRef to be 32 and 64 bits respectively. It would >be nice if this also handled half, fp128, x86_fp80 and ppc_fp128, to be orthogonal.
>> I changed added comments for getFP and I added a constructor for half. I can't think of a good constructor signature for the other float types.
>>
>>>Elts.push_back(CFP->getValueAPF().bitcastToAPInt().getZExtValue());
>>>
>>>There's no actual zero-extension happening here, right? If not, I don't really see a clearly way to write it, maybe getLimitedValue?
>> I changed the getZExtValue() to getLimitedValue
>>
>> The new patch is attached. Could someone commit it since I don't have write access?
>>
>> Thomas
>>
>> -----Original Message-----
>> From: Nick Lewycky [mailto:nicholas at mxc.ca]
>> Sent: Sunday, February 08, 2015 2:40 PM
>> To: Raoux, Thomas F
>> Cc: 'llvm-commits at cs.uiuc.edu'
>> Subject: Re: [PATCH] Avoid conversion to float when creating
>> ConstantDataArray/ConstantDataVector
>>
>> Raoux, Thomas F wrote:
>>> Re-attaching the patch
>>
>> +  static Constant *getFP(LLVMContext &Context, ArrayRef<uint32_t>
>> + Elts);  static Constant *getFP(LLVMContext &Context,
>> + ArrayRef<uint64_t> Elts);
>>
>> Please give getFP its own group with its own doxygen comment describing the conversion, and maybe mention that float and double are defined in LangRef to be 32 and 64 bits respectively. It would be nice if this also handled half, fp128, x86_fp80 and ppc_fp128, to be orthogonal.
>>
>> -            Elts.push_back(CFP->getValueAPF().convertToFloat());
>> +
>> Elts.push_back(CFP->getValueAPF().bitcastToAPInt().getZExtValue());
>>
>> There's no actual zero-extension happening here, right? If not, I don't really see a clearly way to write it, maybe getLimitedValue?
>>
>> The logic of the change and test look good to me.
>>
>> Nick
>>
>>>
>>> -----Original Message-----
>>> From: Raoux, Thomas F
>>> Sent: Thursday, February 05, 2015 10:23 AM
>>> To: 'llvm-commits at cs.uiuc.edu'
>>> Subject: [PATCH] Avoid conversion to float when creating
>>> ConstantDataArray/ConstantDataVector
>>>
>>> Ping. Could someone look at this patch about ConstantDataVector?
>>>
>>> -----Original Message-----
>>> From: Raoux, Thomas F
>>> Sent: Wednesday, January 28, 2015 8:15 AM
>>> To: 'llvm-commits at cs.uiuc.edu'
>>> Subject: [Patch] Avoid conversion to float when creating
>>> ConstantDataArray/ConstantDataVector
>>>
>>> Hi,
>>>
>>> Could someone review (and possibly commit) this patch related to ConstantDataArray/ConstantDataVector?
>>>
>>> This addresses a bug discussed in this thread:
>>> http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-January/080575.html
>>>
>>> To avoid conversion to float and potential change of the constant I added new constructors for float types for ConstantDataArray/ConstantDataVector.
>>>
>>> Cheers,
>>> Thomas
>>>
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>




More information about the llvm-commits mailing list