public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Matthew Malcomson <matmal01@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] morello: Account for a zero MOVE_RATIO when estimating the cost of a move Date: Fri, 10 Dec 2021 16:49:28 +0000 (GMT) [thread overview] Message-ID: <20211210164928.A24653857C44@sourceware.org> (raw) https://gcc.gnu.org/g:41494f7e04b40df3d6d25ff5811557ed8e692880 commit 41494f7e04b40df3d6d25ff5811557ed8e692880 Author: Stam Markianos-Wright <stam.markianos-wright@arm.com> Date: Thu Nov 4 15:40:13 2021 +0000 morello: Account for a zero MOVE_RATIO when estimating the cost of a move In disabling the move-by-pieces infrastructure we set MOVE_RATIO to zero in the AArch64 backend. This source location, however, used the MOVE_RATIO to guess if a move would later result in a memcpy call and so this would always be TRUE, resulting in the assumption that a memcpy would always happen and the move cost being set to 4. This patch adds a !MOVE_RATIO condition to stop this invalid behaviour and always fall through to the estimating based on the MOVE_MAX_PIECES calculation. This also led to a detection of an upstream bug in the Graphite pass, so that pass has now been disabled to avoid this wrong code. This is: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103247 Diff: --- gcc/graphite.c | 8 ++++++++ gcc/tree-inline.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/gcc/graphite.c b/gcc/graphite.c index 1c702d09500..a6627b0b778 100644 --- a/gcc/graphite.c +++ b/gcc/graphite.c @@ -462,6 +462,14 @@ graphite_transform_loops (void) if (dbg_cnt (graphite_scop)) { scop->isl_context = ctx; + + /* MORELLO TODO (OPTIMISED): Disabling this optimisation pass after + detecting an optimisation that had an impact on correctness for + Morello and for base AArch64. Details at: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103247 . */ + if (targetm.capability_mode().exists()) + continue; + if (!build_poly_scop (scop)) continue; diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 3160ca3f88a..48cdb8da59c 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -4129,8 +4129,14 @@ estimate_move_cost (tree type, bool ARG_UNUSED (speed_p)) } size = int_size_in_bytes (type); - - if (size < 0 || size > MOVE_MAX_PIECES * MOVE_RATIO (speed_p)) + /* For capability targets MOVE_RATIO is set to zero to disable the + move-by-pieces infrastructure and avoid invalidating capabilities, so + also take that into account and use a slightly different reasonable + calculation to see if the move will result in a memcpy call. */ + if (size < 0 || size > (MOVE_RATIO (speed_p) ? MOVE_RATIO (speed_p) + : MOVE_MAX_PIECES + / (speed_p ? 2 : 4)) + * MOVE_MAX_PIECES) /* Cost of a memcpy call, 3 arguments and the call. */ return 4; else
reply other threads:[~2021-12-10 16:49 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20211210164928.A24653857C44@sourceware.org \ --to=matmal01@gcc.gnu.org \ --cc=gcc-cvs@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).