From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9F63B3858C52; Sat, 18 May 2024 19:57:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F63B3858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716062230; bh=G7IyYMvTheAtQESI71rRul+iuzX8W/X/zcnz0mKuycY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gZVayrCRCEzhoWcAVHEPCc/83hk4pbDysxJ7VpC/mMnvs1Be9kyQNgZ+FFRXmGu4+ DlFdFoBbQgvC/J0Ta9le5XE5AmNjs0x8dmAdUim5kz7uOxSz/ANTHYjVCZRHs7rm1x KPfqadpHJGWSVei6j8L2iDqO6RRwfKlee9CxwmDY= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/115035] Missed optimization: fold min/max in phi Date: Sat, 18 May 2024 19:57:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: NEW 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_status everconfirmed cf_reconfirmed_on Message-ID: In-Reply-To: References: 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 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2024-05-18 --- Comment #1 from Andrew Pinski --- Confirmed. GCC does have some code that handles some of this in phiopt but = not in a generic way. Jump threading can handle: ``` int src1(unsigned a, unsigned b, int c) { unsigned phi; if(c) { dummy(); phi =3D a < 5 ? a : 5; } else { phi =3D b; } if (phi < 6) dummy(); } ``` But not: ``` int src(unsigned a, unsigned b, int c) { unsigned phi; if(c) { dummy(); phi =3D a < 5 ? a : 5; } else { phi =3D b; } return (phi < 6); dummy(); } ```=