<div class="gmail_quote">2009/6/12 Frits van Bommel <span dir="ltr"><<a href="mailto:fvbommel@wxs.nl">fvbommel@wxs.nl</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div class="im">Nick Lewycky wrote:<br>
> Author: nicholas<br>
> Date: Fri Jun 12 10:56:56 2009<br>
> New Revision: 73230<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=73230&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=73230&view=rev</a><br>
> Log:<br>
> Given two identical weak functions, produce one internal function and two weak<br>
> thunks.<br>
<br>
</div><div class="im">> +    case ExternalWeak: {<br>
> +      assert(catG == ExternalWeak);<br>
> +<br>
> +      // Make them both thunks to the same internal function.<br>
> +      F->setAlignment(std::max(F->getAlignment(), G->getAlignment()));<br>
> +      Function *H = Function::Create(F->getFunctionType(), F->getLinkage(), "",<br>
> +                                     F->getParent());<br>
> +      H->copyAttributesFrom(F);<br>
> +      H->takeName(F);<br>
> +<br>
> +      ThunkGToF(F, G);<br>
> +      ThunkGToF(F, H);<br>
> +<br>
> +      F->setLinkage(GlobalValue::InternalLinkage);<br>
> +    } break;<br>
<br>
</div>Here you're basically creating a declaration H with an identical signature to F<br>
just so ThunkGtoF can suck the life out of it, replace it with a thunk, and<br>
delete it, right?<br>
<br>
So shouldn't you also call F->replaceAllUsesWith(H) before doing that? Otherwise<br>
all uses of F would keep using the now-internal version instead of the thunk<br>
created for them...</blockquote><div><br>Oops! Yes, you're exactly right. I'll commit the fix momentarily.<br><br>Thanks for doing review!<br><br>Nick<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<br>
<div><div></div><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br>