<div dir="ltr">Yeah, you can, at the expense of making the callback more messy, and I liked the version with multiple callbacks better.<div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 24, 2015 at 4:52 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 24 December 2015 at 09:38, Keno Fischer <<a href="mailto:kfischer@college.harvard.edu" target="_blank">kfischer@college.harvard.edu</a>> wrote:<br>
> Say you use a global in a function in some other module. If I understand<br>
> your patch correctly it would recursively complain about all the<br>
> instructions which have some use relation to the one that uses the bad<br>
> global as opposed to just the first one.<br>
<br>
</span>I see, but can still use the general user walker by allowing the<br>
callback to stop the recursion, no:<br>
<br>
static void forEachUser(const Value *V, SmallPtrSet<const Value *, 32> &Visited,<br>
                        llvm::function_ref<void(const Value *)> Callback) {<br>
  if (!Visited.insert(V).second)<br>
    return;<br>
  for (const Value *U : V->materialized_users()) {<br>
    if (Callback(U))<br>
      forEachUser(U, Visited, Callback);<br>
  }<br>
}<br>
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br></div></div>