public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] morello: Account for a zero MOVE_RATIO when estimating the cost of a move
@ 2021-12-10 16:49 Matthew Malcomson
0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2021-12-10 16:49 UTC (permalink / raw)
To: gcc-cvs
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-12-10 16:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 16:49 [gcc(refs/vendors/ARM/heads/morello)] morello: Account for a zero MOVE_RATIO when estimating the cost of a move Matthew Malcomson
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).