[cfe-dev] Reaching the end of a value-returning function in C++

John McCall rjmccall at apple.com
Mon Oct 15 21:45:04 PDT 2012


On Oct 15, 2012, at 9:34 PM, Richard Smith wrote:
> On Mon, Oct 15, 2012 at 11:39 AM, Argyrios Kyrtzidis <kyrtzidis at apple.com> wrote:
> 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.
> 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.
> 
> 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?)

FWIW, I endorse using 'unreachable' here outside of -O0.

John.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121015/603de6ef/attachment.html>


More information about the cfe-dev mailing list