From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 193F13858C53; Sun, 8 Oct 2023 03:52:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 193F13858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696737147; bh=545g9Z1VGDJ1yw6s+EtZ4X8irEkZL9WxvzQPKmoK4h0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JS4u0klk8qQR+q2ynNH4rM2LF7N8fG6Z+Bgw8An9rFlFmqPMX2q6iQFhVnXBUNaxx 1WkUvtrKgLSgHg9cvqihXKbB5BlmD4e3c7MJbf1e4Q3wEg0ebdf9DYitBVCbajwpAA 1IzQ49Cucc2cHF3idSQfyNGK+MkDu2SkrmhYDhdg= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111718] Missed optimization of '(a+a)/a' Date: Sun, 08 Oct 2023 03:52:26 +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: X-Bugzilla-Severity: normal 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: 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=3D111718 --- Comment #3 from Andrew Pinski --- For comment #2 from EVRP: Folding statement: _3 =3D _2 / a_5(D); Applying pattern match.pd:934, gimple-match-4.cc:2021 gimple_simplified to _3 =3D 2; Which corresponds to the match pattern: /* Simplify (t * 2) / 2) -> t. */ (for div (trunc_div ceil_div floor_div round_div exact_div) (simplify (div (mult:c @0 @1) @1) (if (ANY_INTEGRAL_TYPE_P (type)) (if (TYPE_OVERFLOW_UNDEFINED (type)) @0 #if GIMPLE (with {value_range vr0, vr1;} (if (INTEGRAL_TYPE_P (type) && get_range_query (cfun)->range_of_expr (vr0, @0) && get_range_query (cfun)->range_of_expr (vr1, @1) && range_op_handler (MULT_EXPR).overflow_free_p (vr0, vr1)) @0)) #endif ))))=