From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#54532: [PATCH] sorting Date: Thu, 24 Mar 2022 10:36:49 +0100 Message-ID: <63887D60-7631-4583-A76C-B051FE5D9B78@acm.org> References: <320D86FD-5B2E-4177-9570-A8004A942E8C@acm.org> <831qyretr4.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33995"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acohen@ust.hk, 54532@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 24 10:38:16 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nXJv5-0008gA-Vx for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Mar 2022 10:38:16 +0100 Original-Received: from localhost ([::1]:59406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nXJv4-00018w-Nf for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Mar 2022 05:38:14 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nXJus-00016j-2Z for bug-gnu-emacs@gnu.org; Thu, 24 Mar 2022 05:38:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52923) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nXJur-0005Wa-O3 for bug-gnu-emacs@gnu.org; Thu, 24 Mar 2022 05:38:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nXJur-0003mS-Jo for bug-gnu-emacs@gnu.org; Thu, 24 Mar 2022 05:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Mar 2022 09:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54532 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 54532-submit@debbugs.gnu.org id=B54532.164811463214472 (code B ref 54532); Thu, 24 Mar 2022 09:38:01 +0000 Original-Received: (at 54532) by debbugs.gnu.org; 24 Mar 2022 09:37:12 +0000 Original-Received: from localhost ([127.0.0.1]:46820 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nXJtp-0003km-EP for submit@debbugs.gnu.org; Thu, 24 Mar 2022 05:37:12 -0400 Original-Received: from mail208c50.megamailservers.eu ([91.136.10.218]:57782 helo=mail194c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nXJtn-0003kc-1H for 54532@debbugs.gnu.org; Thu, 24 Mar 2022 05:36:56 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1648114612; bh=f5eGMIqO5WyEzSRmJKZIpvWT1hBs5jb/f9ujuspCcxw=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=G0rUqftdrTkwKoDCZzxs8Jwon+L++uNjETSLF4rzo8l5JeYTMzEP6Uz3aurHUco55 eYrBqYbY6XCof2QMEMM5TvYa0+oxj9caT92Q33gxNLxE3yiXKohYd8vAn+z2ZmGZm0 CwzyDGi1fbpqU3g/vOcAYZBzSC4Sj+6E+pS2V7T8= Feedback-ID: mattiase@acm.or Original-Received: from smtpclient.apple (c-b952e353.032-75-73746f71.bbcust.telenor.se [83.227.82.185]) (authenticated bits=0) by mail194c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 22O9anYZ004945; Thu, 24 Mar 2022 09:36:51 +0000 In-Reply-To: <831qyretr4.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.120.0.1.13) X-CTCH-RefID: str=0001.0A742F1A.623C3BB4.005E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-Origin-Country: SE X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:228869 Archived-At: 24 mars 2022 kl. 07.42 skrev Eli Zaretskii : > That instance was > at the end of the function, right before it returns, and I wonder what > kind of optimization opportunities that could present. I don't think we need to justify every single `eassume` on the concrete = utility for a compiler; in general, the more information we give it, the = better code it can produce. It just doesn't hurt to do so. In fact, the only reason we have `eassert` at all is for assertions that = may be time-consuming or otherwise affect the execution (that is, = expressions that the compiler just can't optimise away). For anything = else, `eassume` is strictly better since it does all that `eassert` = does, but with the extra optimisation hints. Now in this concrete case, we state that `lastofs` and `ofs` are equal = at the point when we are about to return `ofs`, and that gives the = compiler the option to return `lastofs` instead, should that be more = convenient in some way. The compiler also knows that lastofs >=3D ofs because of the loop = condition, which means that it can deduce that lastofs > ofs can never = occur which can have various uses -- for example, in the statement ptrdiff_t m =3D lastofs + ((ofs - lastofs) >> 1); it would know that the argument being shifted is nonnegative, which = might be useful in instruction selection. And so on.