public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.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 [thread overview] Message-ID: <bug-89430-4-vRSoOWffey@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-89430-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89430 --- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:cf39dccf9284d2fd9f9aa7050760adea110c8d88 commit r10-7952-gcf39dccf9284d2fd9f9aa7050760adea110c8d88 Author: Jakub Jelinek <jakub@redhat.com> 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 thread could be accessing it concurrently). 2020-04-25 Jakub Jelinek <jakub@redhat.com> Richard Biener <rguenther@suse.de> 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.
next parent reply other threads:[~2020-04-24 22:10 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-89430-4@http.gcc.gnu.org/bugzilla/> 2020-04-24 22:10 ` cvs-commit at gcc dot gnu.org [this message] 2020-04-24 22:25 ` jakub at gcc dot gnu.org 2020-04-28 9:59 ` tnfchris at gcc dot gnu.org 2020-06-04 9:08 ` cvs-commit at gcc dot gnu.org 2022-11-11 8:47 ` tnfchris at gcc dot gnu.org 2022-11-11 8:53 ` jiangning.liu at amperecomputing dot com 2022-11-11 9:32 ` tnfchris at gcc dot gnu.org 2022-11-28 22:18 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-89430-4-vRSoOWffey@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).