emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] trunk r114593: * lisp.h (eassert): Don't use 'assume'.


From: Daniel Colascione
Subject: Re: [Emacs-diffs] trunk r114593: * lisp.h (eassert): Don't use 'assume'.
Date: Fri, 11 Oct 2013 02:10:27 -0700
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.0

On 10/11/13 1:59 AM, Stephen J. Turnbull wrote:
apparently optimizers are sufficiently stupid
as to compile worse code when assume is present (at least that's what
Paul seemed to claim).

I don't think that's actually the case. We implement assume using GCC's __builtin_unreachable: if (!(assumed_condition)) { __builtin_unreachable(); }. If assumed_condition has side effects, then normal C language semantics requires that the compiler emit code to implement these side effects. The code required to do so might make the surrounding code "worse" than it would be otherwise, but the problem is with the side effects, not the optimizer hint per se. I haven't seen any instance of assume itself reducing the quality of produced code.

We don't have this problem with plain assertions, since in non-checked builds, we emit 0&&(assertion) so that the compiler need not ever actually evaluate assertion. (Also, it's for this reason that MSVC's __assume construct is cleaner than __builtin_unreachable.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]