From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0CD363858C35; Fri, 12 Apr 2024 13:50:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0CD363858C35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712929853; bh=2GUaw4Xzsm0rzN4/2RTMRf4n9OLCvL8LEdx565B4axo=; h=From:To:Subject:Date:From; b=TBlTFmBiTRsBlOeNDY1nCDdw5Axd0cVlc7yNowW13iY0/n6P+7YAfS10HWkM6fAll Y4PvnPWYZ9iuGbp7IRZ3QgtaO9lDfgfyE6qinHoWhHUpV5cNEDwvtpV0zK/kKtlHcl fVvIay9c0kKxXwTe6e9953NPhYPDzex1dqTFEGjA= From: "xxs_chy at outlook dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114702] New: Missed optimization: fail to infer c - b != if a + b != c Date: Fri, 12 Apr 2024 13:50:52 +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: xxs_chy at outlook dot com 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=3D114702 Bug ID: 114702 Summary: Missed optimization: fail to infer c - b !=3D if a + b !=3D c Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: xxs_chy at outlook dot com Target Milestone: --- Godbolt link: https://godbolt.org/z/58rxGaabW ``` void src(int a, int b){ if(b + a =3D=3D 32){ return; }else{ if(32 - b =3D=3D a) dummy(); else dummy1(); } } ``` Obviously, "32 - b =3D=3D a" is false. We can get: ``` void tgt(int a, int b){ if(b + a =3D=3D 32){ return; }else{ dummy1(); } } ``` This is a real-world dead code after inlining functions in QEMU.=