From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 76776384B821; Mon, 11 Jan 2021 09:36:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 76776384B821 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/95852] Failure to optimize __builtin_mul_overflow pattern Date: Mon, 11 Jan 2021 09:36:37 +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: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jan 2021 09:36:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95852 --- Comment #3 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:a2106317cd6673e110b347c70f21e25fbb23379e commit r11-6579-ga2106317cd6673e110b347c70f21e25fbb23379e Author: Jakub Jelinek Date: Mon Jan 11 10:32:07 2021 +0100 widening_mul: Pattern recognize unsigned multiplication with overflow c= heck [PR95852] The following patch pattern recognizes some forms of multiplication followed by overflow check through division by one of the operands compared to t= he other one, with optional removal of guarding non-zero check for that operand if possible. The patterns are replaced with effectively __builtin_mul_overflow or __builtin_mul_overflow_p. The testcases cove= r 64 different forms of that. 2021-01-11 Jakub Jelinek PR tree-optimization/95852 * tree-ssa-math-opts.c (maybe_optimize_guarding_check): New function. (uaddsub_overflow_check_p): Renamed to ... (arith_overflow_check_p): ... this. Handle also multiplication with overflow check. (match_uaddsub_overflow): Renamed to ... (match_arith_overflow): ... this. Add cfg_changed argument.=20 Handle also multiplication with overflow check. Adjust function comme= nt. (math_opts_dom_walker::after_dom_children): Adjust callers. Ca= ll match_arith_overflow also for MULT_EXPR. * gcc.target/i386/pr95852-1.c: New test. * gcc.target/i386/pr95852-2.c: New test.=