<div dir="ltr">Probably my fundamental question is that why we need a "success" for each category. There are many types of errors which can be categorized, but to me success is just success, and I don't see any need to distinguish them.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 8, 2015 at 8:50 PM, Sean Silva <span dir="ltr"><<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Mon, Jun 8, 2015 at 8:16 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Mon, Jun 8, 2015 at 7:45 PM, Sean Silva <span dir="ltr"><<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">What is calling object::object_category so much that it can occupy 9% of the run time? If that code path is sufficiently common maybe it should just not be using "errors" in the first place.</blockquote><div><br></div></span><div>Good point. There are many places in include/llvm/Object where we return object_error::success. That seems the cause of this problem.</div><div><br></div><div>Maybe we should remove object_error::success and use std::error_code instead.</div><div><br></div><div>Any objection?</div></div></div></div></blockquote><div><br></div></span><div>I'm not sure that is the right solution (maybe it is, CC'ing Michael). We use the <system_error> API in many places in LLVM and I would like to make sure that we are not paying this cost anywhere. For example, we are also using ManagedStatic for BitcodeErrorCategoryType, which probably leads to similar problems. I'm having a hard time believing that this API got standardized if it is impossible to use with low overhead.</div><div><br></div><div>E.g. I'm wondering why _object_error_category requires runtime initialization at all. The class is empty. So is error_category (its base class). It should just be a vptr with a relocation against it. With LTO, all calls to <span style="font-size:13px">object::object_category</span> should be inlined and fully constant folded.</div><div><br></div><div>CC'ing Michael who knows more about this error handling API. Michael, do you know if there is a way to use this API that doesn't require runtime initialization of the error_category objects?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-- Sean Silva</div></font></span><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Overall, just relying on thread-safe statics is preferable, but even then having so many non-inlined calls to this function in regular operation doesn't seem right.<br>
<br>
<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D10303&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=Egyb7ozJTytiVCP8Jq0n_5B4k7EexSI39kj9hLYnjkI&s=KV-_y6j_TA_nP1ZuwLrKY9402vxsKKpaXtKnsDRP01w&e=" target="_blank">http://reviews.llvm.org/D10303</a><br>
<br>
EMAIL PREFERENCES<br>
  <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_settings_panel_emailpreferences_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=Egyb7ozJTytiVCP8Jq0n_5B4k7EexSI39kj9hLYnjkI&s=gQcsbpOsd-kc0P5AJyC-_GGOWX-tPYkaJfS3Pg3-EtY&e=" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
<br>
<br>
</blockquote></span></div><br></div></div>
</blockquote></span></div><br></div></div>
</blockquote></div><br></div>