From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2AABF3858D1E; Fri, 8 Sep 2023 21:46:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2AABF3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694209568; bh=qH6pWlZSUjwpXRBeGIGNkqaOgldY9Kg7Oa9WlJT3a98=; h=From:To:Subject:Date:From; b=lbPAUgCLgrW3P1qyLLNM9kEYnuG2OAflufcEv3/x46BK47NPElnSAp+Mfqjr02s6C lasPYj1DpZ2EsSHSS08VVmEXtxduMt2srriw1NrzsHyD8UIg0QmqPJrkfFPId/7GZ8 w6KNZ/fzrWl1E6prJMvWP+9iRzSx+PBjLiUempus= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111345] New: `X % Y is smaller than Y.` pattern could be simpified Date: Fri, 08 Sep 2023 21:46:07 +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: internal-improvement 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: pinskia 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=3D111345 Bug ID: 111345 Summary: `X % Y is smaller than Y.` pattern could be simpified Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: internal-improvement Severity: enhancement Priority: P3 Component: tree-optimization Assignee: pinskia at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Right now it is defined as: ``` (for cmp (lt ge) (simplify (cmp (trunc_mod @0 @1) @1) (if (TYPE_UNSIGNED (TREE_TYPE (@0))) { constant_boolean_node (cmp =3D=3D LT_EXPR, type); }))) (for cmp (gt le) (simplify (cmp @1 (trunc_mod @0 @1)) (if (TYPE_UNSIGNED (TREE_TYPE (@0))) { constant_boolean_node (cmp =3D=3D GT_EXPR, type); }))) ``` But it could be simplified to: ``` (for cmp (lt ge) (simplify (cmp:c (trunc_mod @0 @1) @1) (if (TYPE_UNSIGNED (TREE_TYPE (@0))) { constant_boolean_node (cmp =3D=3D LT_EXPR, type); }))) ``` This simplifies the written code but the produced code is the same ...=