From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 837FA3858037; Thu, 11 Jan 2024 19:20:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 837FA3858037 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705000816; bh=91FD36UKUzoVvAdA6zl9MLJdpRsNRZBzCZga1kDpoa0=; h=From:To:Subject:Date:From; b=nkr1xvufk/VlpE7mJb6v9BrcwkJlMNQ/LOKUlp0oZ6AWSvXd/e5U4N3KKoHYDMJLn A8xzN7dPIZWd+sOxkvllUE6ZsMV5dz603NwW/79CEjIFdzXJSzGqsPYEky0y9F9pRs XwuUVUniUnzMiRJ4QVFX7VwwDOIHjKpTSP8W/d/o= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113339] New: `-a/-b` is not simplified to `a/b` if done in seperate statements Date: Thu, 11 Jan 2024 19:20:16 +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: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org 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 keywords 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=3D113339 Bug ID: 113339 Summary: `-a/-b` is not simplified to `a/b` if done in seperate statements Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` int unopt(int a, int b) { a =3D -a; b =3D -b; return a / b; } int opt(int a, int b) { return -a / -b; } ``` I would have expected these 2 would produce the same assembly but only opt = is optimized to a/b and the neg is removed. Note LLVM does not do either: https://github.com/llvm/llvm-project/issues/7= 7717 .=