From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C6DA9395CCCB; Fri, 24 Apr 2020 22:10:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6DA9395CCCB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587766246; bh=CJhlIuvVgEwTSciVV+D0yc8Es0kiwrVtnREQNjcFd98=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Bfcd5Kzg+Pu7PxnWqfXw1KmjUII/bM+9oLifCwxpZyANoglfYJVQvdnCWwL80kSld JlUtrQticGqK8MDP14kn8FH+6tBWeSnoEQJb3fSNKw/JTtdOYbh8OG834dn4uaCCpp ig+uXegpdij7bdLW7liaawcg6SjJ2QA0lGbuxFi0= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/89430] A missing ifcvt optimization to generate csel Date: Fri, 24 Apr 2020 22:10:46 +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: 9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED 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 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: Fri, 24 Apr 2020 22:10:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D89430 --- Comment #12 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:cf39dccf9284d2fd9f9aa7050760adea110c8d88 commit r10-7952-gcf39dccf9284d2fd9f9aa7050760adea110c8d88 Author: Jakub Jelinek Date: Sat Apr 25 00:10:01 2020 +0200 cselim: Don't assume it is safe to cstore replace a store to a local variable with unknown offset [PR94734] As the new testcase shows, it is not safe to assume we can optimize a conditional store into an automatic non-addressable var, we can do it only if we can prove that the unconditional load or store actually will not be outside of the boundaries of the variable. If the offset and size are constant, we can, but this is already all checked in !tree_could_trap_p, otherwise we really need to check for a dominating unconditional store, or for the specific case of automatic non-addressable variables, it is enough if there is a dominating load (that is what those 4 testcases have). tree-ssa-phiopt.c has some infrastructure for this already, see the add_or_mark_expr method etc., but right now it handles only MEM_REFs with SSA_NAME first operand and some integral offset. So, I think it can be for GCC11 extended to handle other memory references, possibly up to just doing get_inner_reference and hasing based on the base, offset expressions and bit_offset and bit_size, and have also a special case that for !TREE_ADDRESSABLE automatic variables it could ignore whether something is a load or store because the local stack should be always writable. But it feels way too dangerous to do this this late for GCC10, so this patch just restricts the optimization to the safe case (where lhs doesn= 't trap), and on Richi's request also ignores TREE_ADDRESSABLE bit if flag_store_data_races, because my understanding the reason for TREE_ADDRESSABLE check is that we want to avoid introducing store data races (if address of an automatic var escapes, some other th= read could be accessing it concurrently). 2020-04-25 Jakub Jelinek Richard Biener PR tree-optimization/94734 PR tree-optimization/89430 * tree-ssa-phiopt.c: Include tree-eh.h. (cond_store_replacement): Return false if an automatic variable access could trap. If -fstore-data-races, don't return false just because an automatic variable is addressable. * gcc.dg/tree-ssa/pr89430-1.c: Add xfail. * gcc.dg/tree-ssa/pr89430-2.c: Add xfail. * gcc.dg/tree-ssa/pr89430-5.c: Add xfail. * gcc.dg/tree-ssa/pr89430-6.c: Add xfail. * gcc.c-torture/execute/pr94734.c: New test.=