<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">In the following IR module:<div>–</div><div><div><font face="Menlo">define i8 @foo() #0 {</font></div><div><font face="Menlo">entry:</font></div><div><font face="Menlo">  %call0 = call i8 @bar()</font></div><div><font face="Menlo">  ret i8 %call0</font></div><div><font face="Menlo">}</font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo">declare i8 @bar() #1</font></div><div>–</div><div>@bar() gets marked as its own user in top-of-tree LLVM.  I patched the Verifier to check it (but didn’t commit the patch):</div><div>–</div><div><font face="Menlo">Index: lib/IR/Verifier.cpp</font><br><font face="Menlo">===================================================================</font><br><font face="Menlo">--- lib/IR/Verifier.cpp</font><span class="Apple-tab-span" style="font-family: Menlo; white-space: pre;"> </span><font face="Menlo">(revision 203468)</font><br><font face="Menlo">+++ lib/IR/Verifier.cpp</font><span class="Apple-tab-span" style="font-family: Menlo; white-space: pre;">    </span><font face="Menlo">(working copy)</font><br><font face="Menlo">@@ -360,6 +360,11 @@</font><br><font face="Menlo">           "Global is external, but doesn't have external or weak linkage!",</font><br><font face="Menlo">           &GV);</font><br><font face="Menlo"> </font><br><font face="Menlo">+  for (Value::const_use_iterator UI = GV.use_begin(), UE = GV.use_end();</font><br><font face="Menlo">+       UI != UE; ++UI) {</font><br><font face="Menlo">+    Assert1(*UI != &GV, "Global values cannot be their own uses!", &GV);</font><br><font face="Menlo">+  }</font><br><font face="Menlo">+</font><br><font face="Menlo">   Assert1(!GV.hasAppendingLinkage() || isa<GlobalVariable>(GV),</font><br><font face="Menlo">           "Only global variables can have appending linkage!", &GV);</font><br>–</div><div>Is it ever reasonable for a global value to be its own use?  If not, can I commit this patch?</div><div><br></div><div>This really causes problems for LLDB in various parts of our logic, including infinite loops when following use chains, but a major issue is that we try to strip certain global values out of the module, and if they’re their own uses then that doesn’t work because we can never eliminate the last use.</div><div><br></div><div>
<div>Sean</div>

</div>
<br></div></body></html>