<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Oct 15, 2012, at 9:45 PM, John McCall <<a href="mailto:rjmccall@apple.com">rjmccall@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Oct 15, 2012, at 9:34 PM, Richard Smith wrote:</div><blockquote type="cite">On Mon, Oct 15, 2012 at 11:39 AM, Argyrios Kyrtzidis <span dir="ltr"><<a href="mailto:kyrtzidis@apple.com" target="_blank">kyrtzidis@apple.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">
<div style="word-wrap:break-word"><div class="h5">Unless I'm missing something, this will benefit functions that are not checked with -Wreturn-type and are supposed to be unreachable in some path but are not marked as such.</div></div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">
<div>I'd prefer that these functions are actually marked as 'unreachable' in source code, instead of depending on the compiler implicitly assuming that in order to get such an optimization.</div></div></blockquote>
<div><br></div><div>I agree, but if they're not marked 'unreachable' in the source code, what IR would you want to produce for code paths which fall off the end? @llvm.trap() at -O0 and unreachable otherwise seems reasonable to me; would you prefer something else? (Perhaps always emitting a call to @llvm.trap?)</div>
</div></blockquote><br></div><div>FWIW, I endorse using 'unreachable' here outside of -O0.</div></div></blockquote><div><br></div><div>Compared to 'unreachable', I prefer always emitting a call to @llvm.trap.</div><div><br></div><div>Please keep in mind that there's debugging and investigation of crash reports from -Os/O2 code as well..</div><div>I didn't yet see an argument that there's enough optimization opportunity in practical terms to justify the havoc that 'unreachable' will cause with a buggy function.</div><div>Valid code is, in reality, going to use 'unreachable' marks and 'noreturn' functions, so all we are going to achieve is "speed up" buggy code, relinquishing any hope of finding the bug or figuring out what is going on in general.</div><div><br></div></div></body></html>