<html dir="ltr"><head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="GENERATOR" content="MSHTML 9.00.8112.16448">
<style title="owaParaStyle"><!--P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
--></style>
</head>
<body ocsi="x">
<div dir="ltr"><font color="#000000" size="2" face="Tahoma">I didn't see a unittest for IRBuilder with existing ConstantFolder and TargetFolder on llvm's unittests and test-suite's unittests directory. And I didn't have experience with making unittest. Can
 you teach me to make unittest? :)</font></div>
<div dir="ltr"><font color="#000000" size="2" face="Tahoma"></font> </div>
<div dir="ltr"><font color="#000000" size="2" face="Tahoma"><font face="tahoma">Thanks for your comment,</font></font></div>
<div dir="ltr"><font color="#000000" size="2" face="Tahoma"><font face="tahoma">Jin-Gu Kang</font></font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div style="DIRECTION: ltr" id="divRpF352354">
<hr tabindex="-1">
<font size="2" face="Tahoma"><b>From:</b> Chandler Carruth [chandlerc@google.com]<br>
<b>Sent:</b> Friday, August 17, 2012 8:03 PM<br>
<b>To:</b> Jin Gu Kang<br>
<b>Cc:</b> llvm-commits@cs.uiuc.edu<br>
<b>Subject:</b> Re: [llvm-commits] [llvm] r162090 - /llvm/trunk/include/llvm/Support/NoFolder.h<br>
</font><br>
</div>
<div></div>
<div>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?
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Fri, Aug 17, 2012 at 4:00 AM, Jin Gu Kang <span dir="ltr">
<<a href="mailto:jaykang10@imrc.kist.re.kr">jaykang10@imrc.kist.re.kr</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div dir="ltr"><font face="Tahoma"><font size="+0"><font color="#000000">These patched functions alreay exist on ConstantFolder and TargetFolder to avoid same problems.
</font></font></font><font face="Tahoma"><font size="+0"><font color="#000000">you can find these functions on
</font>include/llvm/Support/ConstantFolder.h and include/llvm/Support/TargetFolder.h</font></font></div>
<div dir="ltr"><font face="Tahoma">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.</font></div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr"><font face="tahoma">Thanks,</font></div>
<div dir="ltr"><font face="tahoma">Jin-Gu Kang</font></div>
<div style="DIRECTION: ltr">
<hr>
<font face="Tahoma"><b>From:</b> Chandler Carruth [<a href="mailto:chandlerc@google.com">chandlerc@google.com</a>]<br>
<b>Sent:</b> Friday, August 17, 2012 6:44 PM
<div>
<div class="h5"><br>
<b>To:</b> Jin Gu Kang<br>
<b>Cc:</b> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<b>Subject:</b> Re: [llvm-commits] [llvm] r162090 - /llvm/trunk/include/llvm/Support/NoFolder.h<br>
</div>
</div>
</font><br>
</div>
<div>
<div class="h5">
<div></div>
<div>No, the comment as written makes more sense now.... Although the error doesn't entirely make sense.
<div><br>
<div>But where are you seeing these errors? What compiler?</div>
<div><br>
</div>
<div>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.</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Fri, Aug 17, 2012 at 2:21 AM, Jin Gu Kang <span dir="ltr">
<<a href="mailto:jaykang10@imrc.kist.re.kr">jaykang10@imrc.kist.re.kr</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div dir="ltr"><font color="#000000" face="Tahoma">Thanks for your comment,</font></div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr"><font face="tahoma">This comment means that this function's goal is to avoid ambigious overload error as following when we use NoFolder.</font></div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr">/llvm-3.1.src/include/llvm/Support/IRBuilder.h:841: error: call of overloaded ‘CreateGetElementPtr(llvm::Constant*&, llvm::Constant*&)’ is ambiguous<br>
/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<br>
/llvm-3.1.src/include/llvm/Support/NoFolder.h:194: note:                 llvm::Instruction* llvm::NoFolder::CreateGetElementPtr(llvm::Constant*, llvm::ArrayRef<llvm::Value*>) const</div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr"><font face="tahoma">What do you think about this comment?</font></div>
<div dir="ltr"><font face="tahoma"></font> </div>
<div dir="ltr">"Insertion of NoFolder functions to avoid ambiguous overload warnings or errors like ConstantFolder and TargetFolder."</div>
<div dir="ltr"><font face="times new roman"></font> </div>
<div dir="ltr"><font face="times new roman">Thanks,</font></div>
<div dir="ltr"><font face="times new roman">Jin-Gu Kang</font></div>
<div dir="ltr">
<hr>
</div>
<div dir="ltr"><font face="Tahoma"><b>From:</b> Chandler Carruth [<a href="mailto:chandlerc@google.com">chandlerc@google.com</a>]<br>
<b>Sent:</b> Friday, August 17, 2012 6:01 PM<br>
<b>To:</b> Jin Gu Kang<br>
<b>Cc:</b> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<b>Subject:</b> Re: [llvm-commits] [llvm] r162090 - /llvm/trunk/include/llvm/Support/NoFolder.h<br>
</font><br>
</div>
<div>
<div>
<div></div>
<div>
<div class="gmail_extra">
<div class="gmail_quote">On Fri, Aug 17, 2012 at 1:54 AM, Jin-Gu Kang <span dir="ltr">
<<a href="mailto:jaykang10@imrc.kist.re.kr">jaykang10@imrc.kist.re.kr</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
Author: jaykang10<br>
Date: Fri Aug 17 03:54:57 2012<br>
New Revision: 162090<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=162090&view=rev" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=162090&view=rev</a><br>
Log:<br>
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.<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/Support/NoFolder.h<br>
<br>
Modified: llvm/trunk/include/llvm/Support/NoFolder.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/NoFolder.h?rev=162090&r1=162089&r2=162090&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/NoFolder.h?rev=162090&r1=162089&r2=162090&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Support/NoFolder.h (original)<br>
+++ llvm/trunk/include/llvm/Support/NoFolder.h Fri Aug 17 03:54:57 2012<br>
@@ -181,6 +181,12 @@<br>
                                 ArrayRef<Constant *> IdxList) const {<br>
     return ConstantExpr::getGetElementPtr(C, IdxList);<br>
   }<br>
+  Constant *CreateGetElementPtr(Constant *C, Constant *Idx) const {<br>
+    // This form of the function only exists to avoid ambiguous overload<br>
+    // warnings about whether to convert Idx to ArrayRef<Constant *> or<br>
+    // ArrayRef<Value *>.<br>
</blockquote>
<div><br>
</div>
<div>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.</div>
<div> </div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
+    return ConstantExpr::getGetElementPtr(C, Idx);<br>
+  }<br>
   Instruction *CreateGetElementPtr(Constant *C,<br>
                                    ArrayRef<Value *> IdxList) const {<br>
     return GetElementPtrInst::Create(C, IdxList);<br>
@@ -190,6 +196,12 @@<br>
                                         ArrayRef<Constant *> IdxList) const {<br>
     return ConstantExpr::getInBoundsGetElementPtr(C, IdxList);<br>
   }<br>
+  Constant *CreateInBoundsGetElementPtr(Constant *C, Constant *Idx) const {<br>
+    // This form of the function only exists to avoid ambiguous overload<br>
+    // warnings about whether to convert Idx to ArrayRef<Constant *> or<br>
+    // ArrayRef<Value *>.<br>
+    return ConstantExpr::getInBoundsGetElementPtr(C, Idx);<br>
+  }<br>
   Instruction *CreateInBoundsGetElementPtr(Constant *C,<br>
                                            ArrayRef<Value *> IdxList) const {<br>
     return GetElementPtrInst::CreateInBounds(C, IdxList);<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</body>
</html>