From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 430873858430; Tue, 24 Oct 2023 11:17:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 430873858430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698146267; bh=bfl2+ZwskGCATFSUQ09qtMtCVDeNkRvfUqRU7ZwdrzI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hYO966B6fM/IHReCFY0S9m0W0yy/cYzHia5L6PMW+j+ZaE7/8NRHXAnOXzmNXte8J KMaN6BD01ud5iVdXfBbh6iKyq2eujZRm4k3o5KBulYxHMcgh0ye21j5UdtyLQmkCwQ FmhwcADv0YM1W3rV3dU/vGtSFK1m2Aw225kYJcbY= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104376] Failure to optimize clz equivalent to clz Date: Tue, 24 Oct 2023 11:17:45 +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: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement 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: pinskia 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=3D104376 --- Comment #9 from CVS Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:0fc13e8c0e39c51e82deb93f324d9d86ad8d7460 commit r14-4889-g0fc13e8c0e39c51e82deb93f324d9d86ad8d7460 Author: Andrew Pinski Date: Sun Oct 15 19:15:38 2023 +0000 Improve factor_out_conditional_operation for conversions and constants In the case of a NOP conversion (precisions of the 2 types are equal), factoring out the conversion can be done even if int_fits_type_p returns false and even when the conversion is defined by a statement inside the conditional. Since it is a NOP conversion there is no zero/sign extendi= ng happening which is why it is ok to be done here; we were trying to prev= ent an extra sign/zero extend from being moved away from definition which n= o-op conversions are not. Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: PR tree-optimization/104376 PR tree-optimization/101541 * tree-ssa-phiopt.cc (factor_out_conditional_operation): Allow nop conversions even if it is defined by a statement inside the conditional. gcc/testsuite/ChangeLog: PR tree-optimization/101541 * gcc.dg/tree-ssa/phi-opt-39.c: New test.=