From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.bugs Subject: bug#46670: 28.0.50; [feature/native-comp] possible miscompilation affecting lsp-mode Date: Tue, 23 Feb 2021 09:07:26 +0000 Message-ID: References: <87a6ry46uc.fsf@collares.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20945"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 46670@debbugs.gnu.org, Mauricio Collares To: Andrea Corallo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 23 10:09:26 2021 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 1lETh7-0005KS-Uy for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Feb 2021 10:09:26 +0100 Original-Received: from localhost ([::1]:54756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lETh7-0007oJ-1H for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Feb 2021 04:09:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lETgk-0007oA-6m for bug-gnu-emacs@gnu.org; Tue, 23 Feb 2021 04:09:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lETgj-0001bO-Vp for bug-gnu-emacs@gnu.org; Tue, 23 Feb 2021 04:09:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lETgj-0003GJ-RP for bug-gnu-emacs@gnu.org; Tue, 23 Feb 2021 04:09:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Feb 2021 09:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46670 X-GNU-PR-Package: emacs Original-Received: via spool by 46670-submit@debbugs.gnu.org id=B46670.161407129112480 (code B ref 46670); Tue, 23 Feb 2021 09:09:01 +0000 Original-Received: (at 46670) by debbugs.gnu.org; 23 Feb 2021 09:08:11 +0000 Original-Received: from localhost ([127.0.0.1]:58306 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lETfu-0003FE-Mi for submit@debbugs.gnu.org; Tue, 23 Feb 2021 04:08:11 -0500 Original-Received: from mail-ot1-f41.google.com ([209.85.210.41]:41253) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lETfs-0003Ev-Aj for 46670@debbugs.gnu.org; Tue, 23 Feb 2021 04:08:08 -0500 Original-Received: by mail-ot1-f41.google.com with SMTP id s107so14854259otb.8 for <46670@debbugs.gnu.org>; Tue, 23 Feb 2021 01:08:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5jC+r8DckbjYY7/MEabjU9b/H7fJpZgkGaZPQveNDpI=; b=sBDPgVR1i1cyAG5gwViEUpHZovYkAJ/TPFh9vG1Zw9GHJ76s1jbWZP//mI48OQZpdI pm4yJ5FXZvYrd8PI3lNaW95GN/3YMLsga8wY7WP7LPxUo1v5ALl+EtzdWQvycjb3zdxT EqyR9jhXqO8MHASX21i7feeUDVC2lUpJ6PEWe9lBqDJj6tpoAq5dMCsZK52/iWaTNX25 B1y3DZWVigsAzTUw4VjAk3wka5tW4vH3WTuagtUgJBkuHDsYnpOrJiHtJ9UeT3gAGWoq uLZGWmfJQ66RCjoy3CcuO/cUxzLacJ0wYuwOrcdz1DBTsKpSzWJgk9/M2gaH2gch10Da cTZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5jC+r8DckbjYY7/MEabjU9b/H7fJpZgkGaZPQveNDpI=; b=HjYvPfEr1AFTVowWcBe1LSYdoo1FsyQwQcOXmuw6I+e3ktYMtKLdmU2hP0P0HRV2Up Lv9L/jp+swpYEBtiEgKLypqHEo7mkPLq5pK0Ij4L3NvMybvyAoE9O1VqcELw99YR6wHD nAJZDGIsS+5SLYU9BIp5Uac8qv4K1WY3iWvWNivSNQ3htw4hwMS41mYC7jgVQ7opDIND ycJx0PAfnrb9256i+GFG6OPI8N4X4CpEJPCP/LeZS+mx2RCfTalvqQC+gkrau6sLdN9q FMf0aJl6NN+L0klbx6tDe6TN0phMJYIQhf1GHToJ0G9GEEdncNmca/LBhzrJwB9gy3Z2 iU3w== X-Gm-Message-State: AOAM5328/mzGTguhsKzDbul7JwAc05gCqYrW+Pvj/BEEBcz0zs5DqK76 O8QJ6z8JYE2GmPFlq4/BgYMkKBiPB3Iu9KyzkKw= X-Google-Smtp-Source: ABdhPJxY5e2/QyC47dAFphhZjYAbuGWYygZHlNXONzQpe8GJw+8dolMXwf9vVUavr5EGOKekg04aOSb+fxtSap/VzPc= X-Received: by 2002:a05:6830:1605:: with SMTP id g5mr19739007otr.292.1614071282780; Tue, 23 Feb 2021 01:08:02 -0800 (PST) In-Reply-To: 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:200647 Archived-At: On Mon, Feb 22, 2021 at 11:16 AM Andrea Corallo wrote: > Pip Cet writes: > >> Yes but in this case (and probably others) we *have* to emit this > >> assumption. > > > > Why? Are you saying the compiler requires (assume ...) insns for > > correctness? If it does, I'm afraid that's a serious issue. > > It requires that assume if we want to infer precisely here. If we > give-up emitting this assume it will just works perfectly but we'll miss > to predict the return value as we should. Emitting an assumption about a dead variable only makes sense if the dead variable matches a live one. And in that case, we can just emit the assumption about the live variable to begin with. > > Again, that does seem very complicated, and if it improves > > optimization we could probably improve it much more by modifying the > > byte compiler to pop arguments in the caller rather than the callee. > > To me this sounds considerably more invasive, probably is because I'm > much more used to work with the native compiler code that with the byte > compiler one :) That is a little more invasive, but it's where you're going if you make the major change of allocating your own stack slots rather than letting the byte compiler do it. > I like the idea of the native compiler patch being less invasive as > possible, this was the line I tried to follow and I think so far it > paid. I guess a number of readers would'd agree with this kind of > approach to begin with. I agree with it! That's why "leave slot allocation to the byte compiler" is something I don't want you to throw away unnecessarily, because it's a great simplifying assumption. > I think I should be able to work it out as discussed in one two evenings > and it might be useful for other cases in the future too, so it does not > sound as a big deal to me. It does to me, I must say. There's nothing special about comparisons: you're turning a = a OP b two-operand code into c = a OP b three-operand code. Your code won't be as good as genuine three-operand code, and it won't be as simple as two-operand code. > >> > In fact, all we need to do is tell comp-cond-cstrs-target-mvar to > >> > return nil more often, isn't it? > >> > >> Nope, the target mvar identified is the correct one, we just have ATM no > >> way to reference it reliably into the assume. > > > > We don't have to, let's just not emit an assume about a variable that > > we just introduced and that's never read? > > We disagree :) We can disagree about the "let's" part (and should, of course), but we should agree about the "we don't have to" part, because that's a matter of fact, not opinion. > As the byte compiler does not care about propagating types and values it > can just clobber the variable, here we aim for more so we need it to > keep it live till the assume. If we decide the variable needs to be kept live, the byte compiler should keep it live, not us.