From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 051C5384474B; Fri, 10 May 2024 15:08:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 051C5384474B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715353715; bh=O4PC908UOjTP21/8fAACHF+UeDcHUwB18jzp3AeIdDc=; h=From:To:Subject:Date:From; b=NjrmhQHcQH22rm4e2es8OkSdSP6fpHHMMMXFMnFQLYbKF+AmxCt/aUWysMC/5o3hf KYXFs27vqEtzETQxFNca6gTB1krJOK5hlq0FDBFW5YqiOtXqkgIOEFxGpoXRDuQB+t nFH49APCYRJdWqM4VVGhXT1D7iAcYRZVdGpC0ZSU= From: "xxs_chy at outlook dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/115035] New: Missed optimization: fold min/max in phi Date: Fri, 10 May 2024 15:08:34 +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=3D115035 Bug ID: 115035 Summary: Missed optimization: fold min/max in phi 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/o489f6sj5 ``` bool src(unsigned a, unsigned b, bool c) { unsigned phi; if(c) { dummy(); phi =3D a < 6 ? a : 6; } else { phi =3D b; } return phi < 6; } ``` can be folded to: ``` bool tgt(unsigned a, unsigned b, bool c) { unsigned phi; if(c) { dummy(); phi =3D a; } else { phi =3D b; } return phi < 6; } ```=