aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-12-18 13:40:46 +0100
committerRichard Biener <rguenther@suse.de>2023-12-18 15:25:50 +0100
commit88a398a487ee37f1fc7850740f2d94d895657646 (patch)
tree3e99e945931273744aa46bf53ac5a01ae4c02859
parentac9c81dd76cfc34ed53402049021689a61c6d6e7 (diff)
downloadgcc-88a398a487ee37f1fc7850740f2d94d895657646.zip
gcc-88a398a487ee37f1fc7850740f2d94d895657646.tar.gz
gcc-88a398a487ee37f1fc7850740f2d94d895657646.tar.bz2
middle-end/111975 - dump -> GIMPLE FE roundtrip improvements
The following improves the manual work needed to make a -gimple dump valid input to the GIMPLE FE. First of all it recognizes the 'sizetype' tree and dumps it as __SIZETYPE__, then it changes dumping vector types without name from 'vector(n) T' to 'T [[gnu::vector_size(n')]]' which we can parse in most relevant contexts (and that's shorter than using __attribute__). Third it avoids a NULL_TREE TMR_STEP when it would be one, an optimization that's re-done when generating RTL. PR middle-end/111975 * tree-pretty-print.cc (dump_generic_node): Dump sizetype as __SIZETYPE__ with TDF_GIMPLE. Dump unnamed vector types as T [[gnu::vector_size(n)]] with TDF_GIMPLE. * tree-ssa-address.cc (create_mem_ref_raw): Never generate a NULL STEP when INDEX is specified.
-rw-r--r--gcc/tree-pretty-print.cc25
-rw-r--r--gcc/tree-ssa-address.cc3
2 files changed, 19 insertions, 9 deletions
diff --git a/gcc/tree-pretty-print.cc b/gcc/tree-pretty-print.cc
index 86a7d16..46e1439 100644
--- a/gcc/tree-pretty-print.cc
+++ b/gcc/tree-pretty-print.cc
@@ -2002,7 +2002,9 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
}
else if (tclass == tcc_type)
{
- if (TYPE_NAME (node))
+ if ((flags & TDF_GIMPLE) && node == sizetype)
+ pp_string (pp, "__SIZETYPE__");
+ else if (TYPE_NAME (node))
{
if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
pp_tree_identifier (pp, TYPE_NAME (node));
@@ -2014,11 +2016,22 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
}
else if (TREE_CODE (node) == VECTOR_TYPE)
{
- pp_string (pp, "vector");
- pp_left_paren (pp);
- pp_wide_integer (pp, TYPE_VECTOR_SUBPARTS (node));
- pp_string (pp, ") ");
- dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
+ if (flags & TDF_GIMPLE)
+ {
+ dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
+ pp_string (pp, " [[gnu::vector_size(");
+ pp_wide_integer
+ (pp, tree_to_poly_uint64 (TYPE_SIZE_UNIT (node)));
+ pp_string (pp, ")]]");
+ }
+ else
+ {
+ pp_string (pp, "vector");
+ pp_left_paren (pp);
+ pp_wide_integer (pp, TYPE_VECTOR_SUBPARTS (node));
+ pp_string (pp, ") ");
+ dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
+ }
}
else if (TREE_CODE (node) == INTEGER_TYPE)
{
diff --git a/gcc/tree-ssa-address.cc b/gcc/tree-ssa-address.cc
index b942799..dde5f9f 100644
--- a/gcc/tree-ssa-address.cc
+++ b/gcc/tree-ssa-address.cc
@@ -369,9 +369,6 @@ create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr,
&& !valid_mem_ref_p (TYPE_MODE (type), TYPE_ADDR_SPACE (type), addr))
return NULL_TREE;
- if (addr->step && integer_onep (addr->step))
- addr->step = NULL_TREE;
-
if (addr->offset)
addr->offset = fold_convert (alias_ptr_type, addr->offset);
else