[llvm-commits] [llvm] r162090 - /llvm/trunk/include/llvm/Support/NoFolder.h
Chandler Carruth
chandlerc at google.com
Fri Aug 17 04:03:38 PDT 2012
OK, that makes sense. As I mentioned, can you add a unittest for IRBuilder
which uses NoFolder so that we don't regress our support for it?
On Fri, Aug 17, 2012 at 4:00 AM, Jin Gu Kang <jaykang10 at imrc.kist.re.kr>wrote:
> These patched functions alreay exist on ConstantFolder and TargetFolder
> to avoid same problems. you can find these functions on include/llvm/Support/ConstantFolder.h
> and include/llvm/Support/TargetFolder.h
> I am compiling clang with NoFoldered IRBuilder using GCC-4.4.3 on
> Ubuntu-Server-10.4. Maybe, if you use IRBuilder with NoFolder template
> parameter to make LLVM IR, you can see same errors or warinings.
>
> Thanks,
> Jin-Gu Kang
> ------------------------------
> *From:* Chandler Carruth [chandlerc at google.com]
> *Sent:* Friday, August 17, 2012 6:44 PM
>
> *To:* Jin Gu Kang
> *Cc:* llvm-commits at cs.uiuc.edu
> *Subject:* Re: [llvm-commits] [llvm] r162090 -
> /llvm/trunk/include/llvm/Support/NoFolder.h
>
> No, the comment as written makes more sense now.... Although the error
> doesn't entirely make sense.
>
> But where are you seeing these errors? What compiler?
>
> Unless this is a compiler bug (either in our compilers for not warning,
> or yours for warning) we should add a unittest to ensure that the call
> pattern in question continues to work.
>
>
> On Fri, Aug 17, 2012 at 2:21 AM, Jin Gu Kang <jaykang10 at imrc.kist.re.kr>wrote:
>
>> Thanks for your comment,
>>
>> This comment means that this function's goal is to avoid ambigious
>> overload error as following when we use NoFolder.
>>
>> /llvm-3.1.src/include/llvm/Support/IRBuilder.h:841: error: call of
>> overloaded ‘CreateGetElementPtr(llvm::Constant*&, llvm::Constant*&)’ is
>> ambiguous
>> /llvm-3.1.src/include/llvm/Support/NoFolder.h:180: note: candidates are:
>> llvm::Constant* llvm::NoFolder::CreateGetElementPtr(llvm::Constant*,
>> llvm::ArrayRef<llvm::Constant*>) const
>> /llvm-3.1.src/include/llvm/Support/NoFolder.h:194: note:
>> llvm::Instruction* llvm::NoFolder::CreateGetElementPtr(llvm::Constant*,
>> llvm::ArrayRef<llvm::Value*>) const
>>
>> What do you think about this comment?
>>
>> "Insertion of NoFolder functions to avoid ambiguous overload warnings or
>> errors like ConstantFolder and TargetFolder."
>>
>> Thanks,
>> Jin-Gu Kang
>> ------------------------------
>> *From:* Chandler Carruth [chandlerc at google.com]
>> *Sent:* Friday, August 17, 2012 6:01 PM
>> *To:* Jin Gu Kang
>> *Cc:* llvm-commits at cs.uiuc.edu
>> *Subject:* Re: [llvm-commits] [llvm] r162090 -
>> /llvm/trunk/include/llvm/Support/NoFolder.h
>>
>> On Fri, Aug 17, 2012 at 1:54 AM, Jin-Gu Kang <
>> jaykang10 at imrc.kist.re.kr> wrote:
>>
>>> Author: jaykang10
>>> Date: Fri Aug 17 03:54:57 2012
>>> New Revision: 162090
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=162090&view=rev
>>> Log:
>>> Insertion of NoFolder functions to avoid ambiguous overload warnings or
>>> errors about whether to convert Idx to ArrayRef<Constant *> or
>>> ArrayRef<Value *> like ConstantFolder and TargetFolder.
>>>
>>> Modified:
>>> llvm/trunk/include/llvm/Support/NoFolder.h
>>>
>>> Modified: llvm/trunk/include/llvm/Support/NoFolder.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/NoFolder.h?rev=162090&r1=162089&r2=162090&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/include/llvm/Support/NoFolder.h (original)
>>> +++ llvm/trunk/include/llvm/Support/NoFolder.h Fri Aug 17 03:54:57 2012
>>> @@ -181,6 +181,12 @@
>>> ArrayRef<Constant *> IdxList) const {
>>> return ConstantExpr::getGetElementPtr(C, IdxList);
>>> }
>>> + Constant *CreateGetElementPtr(Constant *C, Constant *Idx) const {
>>> + // This form of the function only exists to avoid ambiguous overload
>>> + // warnings about whether to convert Idx to ArrayRef<Constant *> or
>>> + // ArrayRef<Value *>.
>>>
>>
>> This comment doesn't seem right at all -- this function doesn't accept
>> anything to do with ArrayRef. The comment seems copy/pasted from the edit
>> below where it is correct, but it needs updating for this signature.
>>
>>
>>> + return ConstantExpr::getGetElementPtr(C, Idx);
>>> + }
>>> Instruction *CreateGetElementPtr(Constant *C,
>>> ArrayRef<Value *> IdxList) const {
>>> return GetElementPtrInst::Create(C, IdxList);
>>> @@ -190,6 +196,12 @@
>>> ArrayRef<Constant *> IdxList)
>>> const {
>>> return ConstantExpr::getInBoundsGetElementPtr(C, IdxList);
>>> }
>>> + Constant *CreateInBoundsGetElementPtr(Constant *C, Constant *Idx)
>>> const {
>>> + // This form of the function only exists to avoid ambiguous overload
>>> + // warnings about whether to convert Idx to ArrayRef<Constant *> or
>>> + // ArrayRef<Value *>.
>>> + return ConstantExpr::getInBoundsGetElementPtr(C, Idx);
>>> + }
>>> Instruction *CreateInBoundsGetElementPtr(Constant *C,
>>> ArrayRef<Value *> IdxList)
>>> const {
>>> return GetElementPtrInst::CreateInBounds(C, IdxList);
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120817/04019395/attachment.html>
More information about the llvm-commits
mailing list