<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 20, 2016, at 11:24 AM, Hal Finkel <<a href="mailto:hfinkel@anl.gov" class="">hfinkel@anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: arial, helvetica, sans-serif; font-size: 10pt;" class=""><br class=""><br class=""><hr id="zwchr" class=""><blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-size: 12pt;" class=""><b class="">From:<span class="Apple-converted-space"> </span></b>"Quentin Colombet via llvm-commits" <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>><br class=""><b class="">To:<span class="Apple-converted-space"> </span></b>"Krzysztof Parzyszek" <<a href="mailto:kparzysz@codeaurora.org" class="">kparzysz@codeaurora.org</a>><br class=""><b class="">Cc:<span class="Apple-converted-space"> </span></b>"Benjamin Kramer" <<a href="mailto:benny.kra@gmail.com" class="">benny.kra@gmail.com</a>>, "Chandler Carruth via llvm-commits" <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>><br class=""><b class="">Sent:<span class="Apple-converted-space"> </span></b>Friday, May 20, 2016 1:21:42 PM<br class=""><b class="">Subject:<span class="Apple-converted-space"> </span></b>Re: [llvm] r269969 - When looking for a spill slot in reg scavenger,  find one that matches RC<br class=""><br class=""><br class=""><div class=""><blockquote class=""><div class="">On May 20, 2016, at 9:11 AM, Krzysztof Parzyszek via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; float: none; display: inline !important;">Getting to this particular place in register scavenger is an indication of a problem.  That should not happen under any conditions, so it qualifies for llvm_unreachable.  There is nothing that the user can do to remedy this situation once it happens.  That ties to your comment about when to use unreachable vs report_fatal_error.</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; float: none; display: inline !important;">I was under impression that llvm_unreachable expands to nothing in release mode---turns out it is not true.  I'd rather remove the report_fatal_error and keep the unreachable in this case.</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"></div></blockquote><div class=""><br class=""></div><div class="">My bad, llvm_unreachable does generate a call to abort. I could have swear I saw unreachable just being dropped.</div><div id="DWT4402" class=""><br class=""></div></div></blockquote><br class="">It depends on what kind of build you have:<br class=""><br class="">#ifndef NDEBUG<br class="">#define llvm_unreachable(msg) \<br class="">  ::llvm::llvm_unreachable_internal(msg, __FILE__, __LINE__)<br class="">#elif defined(LLVM_BUILTIN_UNREACHABLE)<br class="">#define llvm_unreachable(msg) LLVM_BUILTIN_UNREACHABLE<br class="">#else<br class="">#define llvm_unreachable(msg) ::llvm::llvm_unreachable_internal()<br class="">#endif<br class=""><br class="">where:<br class=""><br class=""> /// This function calls abort(), and prints the optional message to stderr.<br class="">  /// Use the llvm_unreachable macro (that adds location info), instead of<br class="">  /// calling this function directly.<br class="">  LLVM_ATTRIBUTE_NORETURN void<br class="">  llvm_unreachable_internal(const char *msg=nullptr, const char *file=nullptr,<br class="">                            unsigned line=0);<br class=""></div></div></blockquote><div><br class=""></div>Thanks for the clarification Hal, I am not that crazy then :).</div><div><br class=""></div><div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">/// LLVM_BUILTIN_UNREAC</span><span style="font-variant-ligatures: no-common-ligatures" class="">HABLE - On compilers which support it, expands</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">/// to an expression which states that it is undefined behavior for the</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">/// compiler to reach this point.  Otherwise is not defined.</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div>This is UB, that probably means we can find a case where this is not making the compiler aborting (or at least not with a “nice” message).</div><div>Therefore, I would recommend to stick to report_fatal_error for that case.</div><div><br class=""></div><div>What do people think?</div><div><br class=""></div><div>Q</div><div><blockquote type="cite" class=""><div class=""><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: arial, helvetica, sans-serif; font-size: 10pt;" class=""><br class=""><br class=""> -Hal<br class=""><br class=""><blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-size: 12pt;" class=""><div class=""><div class=""></div><br class=""><blockquote class=""><div class=""><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; float: none; display: inline !important;">-Krzysztof</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; float: none; display: inline !important;">On 5/20/2016 11:01 AM, Benjamin Kramer wrote:</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><blockquote class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">report_fatal_error produces user-visible errors, I don't think<br class="">including stack traces there is in any way helpful and will only cause<br class="">confusion. If a compiler dev doesn't like using a debugger they can<br class="">still grep for the error message and quickly find where it's coming<br class="">from ...<br class=""><br class="">On Fri, May 20, 2016 at 5:51 PM, Krzysztof Parzyszek<br class=""><<a href="mailto:kparzysz@codeaurora.org" class="" target="_blank">kparzysz@codeaurora.org</a>> wrote:<br class=""><blockquote class="">On 5/20/2016 10:43 AM, Benjamin Kramer wrote:<br class=""><blockquote class=""><br class="">You can<br class="">easily get a stack trace from a debugger, no need to use<br class="">llvm_unreachable for that.<br class=""></blockquote><br class=""><br class="">That forces people to use debuggers, which I really don't like.<br class=""><br class="">Maybe printing the stack trace from report_fatal_error (when assertions are<br class="">enabled) would be an option?<br class=""><br class="">-Krzysztof<br class=""><br class=""><br class=""><br class="">--<br class="">Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by<br class="">The Linux Foundation<br class=""></blockquote></blockquote><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; float: none; display: inline !important;">--<span class="Apple-converted-space"> </span></span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; float: none; display: inline !important;">Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; float: none; display: inline !important;">_______________________________________________</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; float: none; display: inline !important;">llvm-commits mailing list</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><a href="mailto:llvm-commits@lists.llvm.org" class="" target="_blank" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">llvm-commits@lists.llvm.org</a><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" class="" target="_blank" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a></div></blockquote></div><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class=""></blockquote><br class=""><br class=""><br class="">--<span class="Apple-converted-space"> </span><br class=""><div class=""><span name="x" class=""></span>Hal Finkel<br class="">Assistant Computational Scientist<br class="">Leadership Computing Facility<br class="">Argonne National Laboratory</div></div></div></blockquote></div><br class=""></body></html>