From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] trunk r114593: * lisp.h (eassert): Don't use 'assume'. Date: Fri, 11 Oct 2013 02:10:27 -0700 Message-ID: <5257C083.5010909@dancol.org> References: <52576305.9000703@dancol.org> <52579C68.1040904@cs.ucla.edu> <83iox4pa0w.fsf@gnu.org> <5257AB8C.40309@dancol.org> <83eh7sp6v0.fsf@gnu.org> <5257B489.2050609@dancol.org> <87eh7si3ny.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1381482703 22987 80.91.229.3 (11 Oct 2013 09:11:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Oct 2013 09:11:43 +0000 (UTC) Cc: Eli Zaretskii , eggert@cs.ucla.edu, emacs-devel@gnu.org To: "Stephen J. Turnbull" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 11 11:11:47 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VUYl8-0008LW-Gy for ged-emacs-devel@m.gmane.org; Fri, 11 Oct 2013 11:11:46 +0200 Original-Received: from localhost ([::1]:53181 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUYl8-0004Tx-0a for ged-emacs-devel@m.gmane.org; Fri, 11 Oct 2013 05:11:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUYkx-0004Tk-5d for emacs-devel@gnu.org; Fri, 11 Oct 2013 05:11:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUYko-0000dD-Oo for emacs-devel@gnu.org; Fri, 11 Oct 2013 05:11:35 -0400 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:47198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUYkc-0000bI-Bo; Fri, 11 Oct 2013 05:11:14 -0400 Original-Received: from [173.252.71.189] (helo=dcolascione-mbp.local) by dancol.org with esmtpsa (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1VUYkb-0001GN-GZ; Fri, 11 Oct 2013 02:11:13 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.0 In-Reply-To: <87eh7si3ny.fsf@uwakimon.sk.tsukuba.ac.jp> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2600:3c01::f03c:91ff:fedf:adf3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:164081 Archived-At: 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.)