From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 461FD3858C54; Sun, 8 Oct 2023 07:55:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 461FD3858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696751747; bh=0t7V2NjzyO46AXBq7lbpRIBpAStOqismm9iTpXpU1w8=; h=From:To:Subject:Date:From; b=ViV/PEsR/e3ltSXElXHW3LhptOn6hbd5CjXfu3yPoWSXE5ybJRHL8alPK44zbRZ/p KdFw4pLEmiJ686LehgP4FOdqZzbgmP5AXcVTAx9KCvZIDCY3qpR/OSuPGFEEbtgSTX 1A5GCKJFcrtCJTMz9ghW/yXIUieaCAJAXX0QQN7c= From: "652023330028 at smail dot nju.edu.cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111724] New: [Regression] Missed optimizations probably because of too early arithmetic optimization Date: Sun, 08 Oct 2023 07:55:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: 652023330028 at smail dot nju.edu.cn X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111724 Bug ID: 111724 Summary: [Regression] Missed optimizations probably because of too early arithmetic optimization Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: 652023330028 at smail dot nju.edu.cn Target Milestone: --- Hello, we found some optimizations (probably because of too early arithmetic optimization) that GCC may have missed. We would greatly appreicate if you = can take a look and let us know what you think. Given the following code: https://godbolt.org/z/8EW8fx78K int n; void func(int w, int a, int b){ for(int i=3D0;iFrom original(tree): (void) (n =3D (a + b) * 2 + n) >>>>>; This leads to: _1 =3D a_11(D) + b_18; _2 =3D _1 * 2; _4 =3D _2 + n_lsm.4_7; So, it looks like the missed LICM is due to too early arithmetic optimizati= on. On gcc-6.4, it works as expected. We found that this also affects other optimizations, such as common subexpression elimination. We can provide examples if required. Thank you very much for your time and effort! We look forward to hearing fr= om you.=