<p dir="ltr">Thanks! </p>
<div class="gmail_quote">On Jul 6, 2015 2:51 PM, "Reid Kleckner" <<a href="mailto:reid@kleckner.net">reid@kleckner.net</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rnk<br>
Date: Mon Jul  6 13:48:02 2015<br>
New Revision: 241483<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D241483-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=tLDAX1f9w3HgST9g-Jgl2PVLp0DNBNR1huEipFyPuWo&s=HsLDhmmOeOIhS-bv0AX_KVIXj-K_jMsZ450mDtS6zI0&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=241483&view=rev</a><br>
Log:<br>
[llvm-extract] Drop comdats from declarations<br>
<br>
The verifier rejects comdats on declarations.<br>
<br>
Modified:<br>
    llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp<br>
    llvm/trunk/test/Other/extract.ll<br>
<br>
Modified: llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Transforms_IPO_ExtractGV.cpp-3Frev-3D241483-26r1-3D241482-26r2-3D241483-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=tLDAX1f9w3HgST9g-Jgl2PVLp0DNBNR1huEipFyPuWo&s=vMAt4slQQEFaBXZryf_-ugESOJxKrmr_Xv7XWOWj1Tc&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp?rev=241483&r1=241482&r2=241483&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/IPO/ExtractGV.cpp Mon Jul  6 13:48:02 2015<br>
@@ -93,8 +93,11 @@ namespace {<br>
<br>
         makeVisible(*I, Delete);<br>
<br>
-        if (Delete)<br>
+        if (Delete) {<br>
+          // Make this a declaration and drop it's comdat.<br>
           I->setInitializer(nullptr);<br>
+          I->setComdat(nullptr);<br>
+        }<br>
       }<br>
<br>
       // Visit the Functions.<br>
@@ -108,8 +111,11 @@ namespace {<br>
<br>
         makeVisible(*I, Delete);<br>
<br>
-        if (Delete)<br>
+        if (Delete) {<br>
+          // Make this a declaration and drop it's comdat.<br>
           I->deleteBody();<br>
+          I->setComdat(nullptr);<br>
+        }<br>
       }<br>
<br>
       // Visit the Aliases.<br>
<br>
Modified: llvm/trunk/test/Other/extract.ll<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_Other_extract.ll-3Frev-3D241483-26r1-3D241482-26r2-3D241483-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=tLDAX1f9w3HgST9g-Jgl2PVLp0DNBNR1huEipFyPuWo&s=Vb_rDVqKRThMiG1zVWRtaJp3XeKbaZ866ALqrkbHP24&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/extract.ll?rev=241483&r1=241482&r2=241483&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/Other/extract.ll (original)<br>
+++ llvm/trunk/test/Other/extract.ll Mon Jul  6 13:48:02 2015<br>
@@ -7,19 +7,22 @@<br>
 ; llvm-extract uses lazy bitcode loading, so make sure it correctly reads<br>
 ; from bitcode files in addition to assembly files.<br>
<br>
-; CHECK: define hidden void @foo() {<br>
+; CHECK: define hidden void @foo() comdat($x) {<br>
 ; CHECK:   ret void<br>
 ; CHECK: }<br>
<br>
 ; The private linkage for foo() should be changed to external linkage and<br>
 ; hidden visibility added.<br>
 ; DELETE: declare hidden void @foo()<br>
+; DELETE-NOT: comdat<br>
 ; DELETE: define void @bar() {<br>
 ; DELETE:   call void @foo()<br>
 ; DELETE:   ret void<br>
 ; DELETE: }<br>
<br>
-define private void @foo() {<br>
+$x = comdat any<br>
+<br>
+define private void @foo() comdat($x) {<br>
   ret void<br>
 }<br>
 define void @bar() {<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" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>