From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 41E063858D20; Thu, 28 Mar 2024 05:54:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 41E063858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711605262; bh=q1CP6YyXP9A2KMRA996DgEGx2obv02ULhUQlaEU2ZJE=; h=From:To:Subject:Date:From; b=vielIpGlm6IuybQu7DQVT8nLZsIrarNNDD9XRQtV0VV/zzJQRtv10znqUEsI5iTyz B4k4aJtiDc6rouYx1X0x/nhExp7mpKMxkLkYzaztV3+wVO27Pf657tSxb4rFaEhJhJ +YXrIo+fgYq9o4AFzdlMn2eZk85sa93di0LSUrRM= From: "652023330028 at smail dot nju.edu.cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114508] New: Missed optimization of Dead Code Elimination Date: Thu, 28 Mar 2024 05:54:21 +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=3D114508 Bug ID: 114508 Summary: Missed optimization of Dead Code Elimination 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 noticed that the code below can be optimized by Dead Code Elimination, but gcc -O3 missed it. Reduced code: https://godbolt.org/z/j9a3Mza3d int a, b; void func(int g, int d){ int x=3Dg+d; if(x>0){ d--; int t=3Dg+d; if(t<0){ //false b=3D1; //dead code } } } GCC -O3: func(int, int): lea eax, [rdi+rsi] test eax, eax jle .L1 lea eax, [rdi-1+rsi] test eax, eax js .L4 .L1: ret .L4: mov DWORD PTR b[rip], 1 ret Expected code (Clang): func(int, int): # @func(int, int) ret Thank you very much for your time and effort! We look forward to hearing fr= om you.=