public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* GCC 11 backports
@ 2021-08-16 11:13 Martin Liška
  2021-08-23  8:54 ` Martin Liška
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Liška @ 2021-08-16 11:13 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 59 bytes --]

I'm going to apply the following 3 tested patches.

Martin

[-- Attachment #2: 0001-ipa-make-target_clone-default-decl-local-PR101726.patch --]
[-- Type: text/x-patch, Size: 1618 bytes --]

From 85b78f6c38bb357abb749fed81a1e7a589050461 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Thu, 12 Aug 2021 16:01:01 +0200
Subject: [PATCH 1/3] ipa: make target_clone default decl local [PR101726]

	PR ipa/101726

gcc/ChangeLog:

	* multiple_target.c (create_dispatcher_calls): Make default
	  function local only if it is a definition.
---
 gcc/multiple_target.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/gcc/multiple_target.c b/gcc/multiple_target.c
index e4192657cef..6c0565880c5 100644
--- a/gcc/multiple_target.c
+++ b/gcc/multiple_target.c
@@ -170,17 +170,20 @@ create_dispatcher_calls (struct cgraph_node *node)
 				      clone_function_name_numbered (
 					  node->decl, "default"));
 
-  /* FIXME: copy of cgraph_node::make_local that should be cleaned up
-	    in next stage1.  */
-  node->make_decl_local ();
-  node->set_section (NULL);
-  node->set_comdat_group (NULL);
-  node->externally_visible = false;
-  node->forced_by_abi = false;
-  node->set_section (NULL);
-
-  DECL_ARTIFICIAL (node->decl) = 1;
-  node->force_output = true;
+  if (node->definition)
+    {
+      /* FIXME: copy of cgraph_node::make_local that should be cleaned up
+		in next stage1.  */
+      node->make_decl_local ();
+      node->set_section (NULL);
+      node->set_comdat_group (NULL);
+      node->externally_visible = false;
+      node->forced_by_abi = false;
+      node->set_section (NULL);
+
+      DECL_ARTIFICIAL (node->decl) = 1;
+      node->force_output = true;
+    }
 }
 
 /* Return length of attribute names string,
-- 
2.32.0


[-- Attachment #3: 0002-ipa-do-not-make-localaliases-for-target_clones-PR101.patch --]
[-- Type: text/x-patch, Size: 1697 bytes --]

From fbe246620e2fa5b5968718837ae4c12fdb85ba39 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Fri, 13 Aug 2021 11:10:56 +0200
Subject: [PATCH 2/3] ipa: do not make localaliases for target_clones
 [PR101261]

	PR ipa/101261

gcc/ChangeLog:

	* symtab.c (symtab_node::noninterposable_alias): Do not create
	  local aliases for target_clone functions as the clonning pass
	  rejects aliases.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr101261.c: New test.
---
 gcc/symtab.c                             |  2 ++
 gcc/testsuite/gcc.target/i386/pr101261.c | 11 +++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr101261.c

diff --git a/gcc/symtab.c b/gcc/symtab.c
index 2135b34ce27..5530a124a9d 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -1959,6 +1959,8 @@ symtab_node::noninterposable_alias (void)
   /* If aliases aren't supported by the assembler, fail.  */
   if (!TARGET_SUPPORTS_ALIASES)
     return NULL;
+  else if (lookup_attribute ("target_clones", DECL_ATTRIBUTES (node->decl)))
+    return NULL;
 
   /* Otherwise create a new one.  */
   new_decl = copy_node (node->decl);
diff --git a/gcc/testsuite/gcc.target/i386/pr101261.c b/gcc/testsuite/gcc.target/i386/pr101261.c
new file mode 100644
index 00000000000..d25d1a202c2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101261.c
@@ -0,0 +1,11 @@
+/* PR middle-end/101261 */
+/* { dg-do compile { target fpic } } */
+/* { dg-options "-fno-semantic-interposition -fPIC" } */
+/* { dg-require-ifunc "" } */
+
+void
+__attribute__((target_clones("default", "avx2")))
+dt_ioppr_transform_image_colorspace()
+{
+  dt_ioppr_transform_image_colorspace();
+}
-- 
2.32.0


[-- Attachment #4: 0003-ipa-ICF-should-check-SSA_NAME_IS_DEFAULT_DEF.patch --]
[-- Type: text/x-patch, Size: 1760 bytes --]

From 5b1bcb10b2cc6c93b06d22da0a044a6a6f362f0b Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Fri, 13 Aug 2021 12:35:47 +0200
Subject: [PATCH 3/3] ipa: ICF should check SSA_NAME_IS_DEFAULT_DEF

	PR ipa/100600

gcc/ChangeLog:

	* ipa-icf-gimple.c (func_checker::compare_ssa_name): Do not
	  consider equal SSA_NAMEs when one is a param.

gcc/testsuite/ChangeLog:

	* gcc.dg/ipa/pr100600.c: New test.
---
 gcc/ipa-icf-gimple.c                |  3 +++
 gcc/testsuite/gcc.dg/ipa/pr100600.c | 22 ++++++++++++++++++++++
 2 files changed, 25 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/ipa/pr100600.c

diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index edf5f025627..cf0262621be 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -96,6 +96,9 @@ func_checker::compare_ssa_name (const_tree t1, const_tree t2)
   unsigned i1 = SSA_NAME_VERSION (t1);
   unsigned i2 = SSA_NAME_VERSION (t2);
 
+  if (SSA_NAME_IS_DEFAULT_DEF (t1) != SSA_NAME_IS_DEFAULT_DEF (t2))
+    return false;
+
   if (m_source_ssa_names[i1] == -1)
     m_source_ssa_names[i1] = i2;
   else if (m_source_ssa_names[i1] != (int) i2)
diff --git a/gcc/testsuite/gcc.dg/ipa/pr100600.c b/gcc/testsuite/gcc.dg/ipa/pr100600.c
new file mode 100644
index 00000000000..8a3d0e16e7e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr100600.c
@@ -0,0 +1,22 @@
+/* PR ipa/100600 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int a, b, c;
+long d(long x, long e, long f, long g) {
+  long h, i;
+  for (; h < e; h++) {
+    i = f;
+    for (; i < g; i++)
+      c = b + a;
+  }
+  return h + i;
+}
+
+long j(long x, long e, long y, long g) {
+  long h, i;
+  for (; h < e; h++)
+    for (; i < g; i++)
+      c = b + a;
+  return h + i;
+}
-- 
2.32.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GCC 11 backports
  2021-08-16 11:13 GCC 11 backports Martin Liška
@ 2021-08-23  8:54 ` Martin Liška
  2021-11-05 16:08   ` Martin Liška
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Liška @ 2021-08-23  8:54 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 145 bytes --]

On 8/16/21 13:13, Martin Liška wrote:
> I'm going to apply the following 3 tested patches.
> 
> Martin

One more patch I've just tested.

Martin

[-- Attachment #2: 0001-gcov-fix-output-location-for-JSON-mode.patch --]
[-- Type: text/x-patch, Size: 8146 bytes --]

From 9310e5f599b68d311e987b77cd0b7c8d3e46c5f8 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Tue, 17 Aug 2021 16:24:26 +0200
Subject: [PATCH] gcov: fix output location for JSON mode.

	PR gcov-profile/89961

gcc/ChangeLog:

	* gcov.c (make_gcov_file_name): Rewrite using std::string.
	(mangle_name): Simplify, do not used the second argument.
	(strip_extention): New function.
	(get_md5sum): Likewise.
	(get_gcov_intermediate_filename): Handle properly -p and -x
	options.
	(output_gcov_file): Use string type.
	(generate_results): Likewise.
	(md5sum_to_hex): Remove.

(cherry picked from commit b777f228b481ae881a7fbb09de367a053740932c)
---
 gcc/gcov.c | 158 ++++++++++++++++++++++++++---------------------------
 1 file changed, 79 insertions(+), 79 deletions(-)

diff --git a/gcc/gcov.c b/gcc/gcov.c
index 5c651a9bdce..cf0a49d8c30 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -662,8 +662,8 @@ static void accumulate_line_counts (source_info *);
 static void output_gcov_file (const char *, source_info *);
 static int output_branch_count (FILE *, int, const arc_info *);
 static void output_lines (FILE *, const source_info *);
-static char *make_gcov_file_name (const char *, const char *);
-static char *mangle_name (const char *, char *);
+static string make_gcov_file_name (const char *, const char *);
+static char *mangle_name (const char *);
 static void release_structures (void);
 extern int main (int, char **);
 
@@ -1134,6 +1134,41 @@ output_intermediate_json_line (json::array *object,
   object->append (lineo);
 }
 
+/* Strip filename extension in STR.  */
+
+static string
+strip_extention (string str)
+{
+  string::size_type pos = str.rfind ('.');
+  if (pos != string::npos)
+    str = str.substr (0, pos);
+
+  return str;
+}
+
+/* Calcualte md5sum for INPUT string and return it in hex string format.  */
+
+static string
+get_md5sum (const char *input)
+{
+  md5_ctx ctx;
+  char md5sum[16];
+  string str;
+
+  md5_init_ctx (&ctx);
+  md5_process_bytes (input, strlen (input), &ctx);
+  md5_finish_ctx (&ctx, md5sum);
+
+  for (unsigned i = 0; i < 16; i++)
+    {
+      char b[3];
+      sprintf (b, "%02x", (unsigned char)md5sum[i]);
+      str += b;
+    }
+
+  return str;
+}
+
 /* Get the name of the gcov file.  The return value must be free'd.
 
    It appends the '.gcov' extension to the *basename* of the file.
@@ -1143,20 +1178,26 @@ output_intermediate_json_line (json::array *object,
    input: foo.da,       output: foo.da.gcov
    input: a/b/foo.cc,   output: foo.cc.gcov  */
 
-static char *
-get_gcov_intermediate_filename (const char *file_name)
+static string
+get_gcov_intermediate_filename (const char *input_file_name)
 {
-  const char *gcov = ".gcov.json.gz";
-  char *result;
-  const char *cptr;
+  string base = basename (input_file_name);
+  string str = strip_extention (base);
 
-  /* Find the 'basename'.  */
-  cptr = lbasename (file_name);
-
-  result = XNEWVEC (char, strlen (cptr) + strlen (gcov) + 1);
-  sprintf (result, "%s%s", cptr, gcov);
+  if (flag_hash_filenames)
+    {
+      str += "##";
+      str += get_md5sum (input_file_name);
+    }
+  else if (flag_preserve_paths && base != input_file_name)
+    {
+      str += "##";
+      str += mangle_path (input_file_name);
+      str = strip_extention (str);
+    }
 
-  return result;
+  str += ".gcov.json.gz";
+  return str.c_str ();
 }
 
 /* Output the result in JSON intermediate format.
@@ -1416,7 +1457,9 @@ process_all_functions (void)
 static void
 output_gcov_file (const char *file_name, source_info *src)
 {
-  char *gcov_file_name = make_gcov_file_name (file_name, src->coverage.name);
+  string gcov_file_name_str
+    = make_gcov_file_name (file_name, src->coverage.name);
+  const char *gcov_file_name = gcov_file_name_str.c_str ();
 
   if (src->coverage.lines)
     {
@@ -1438,13 +1481,12 @@ output_gcov_file (const char *file_name, source_info *src)
       unlink (gcov_file_name);
       fnotice (stdout, "Removing '%s'\n", gcov_file_name);
     }
-  free (gcov_file_name);
 }
 
 static void
 generate_results (const char *file_name)
 {
-  char *gcov_intermediate_filename;
+  string gcov_intermediate_filename;
 
   for (vector<function_info *>::iterator it = functions.begin ();
        it != functions.end (); it++)
@@ -1547,11 +1589,13 @@ generate_results (const char *file_name)
 	  root->print (&pp);
 	  pp_formatted_text (&pp);
 
-	  gzFile output = gzopen (gcov_intermediate_filename, "w");
+	  fnotice (stdout, "Creating '%s'\n",
+		   gcov_intermediate_filename.c_str ());
+	  gzFile output = gzopen (gcov_intermediate_filename.c_str (), "w");
 	  if (output == NULL)
 	    {
 	      fnotice (stderr, "Cannot open JSON output file %s\n",
-		       gcov_intermediate_filename);
+		       gcov_intermediate_filename.c_str ());
 	      return;
 	    }
 
@@ -1559,7 +1603,7 @@ generate_results (const char *file_name)
 	      || gzclose (output))
 	    {
 	      fnotice (stderr, "Error writing JSON output file %s\n",
-		       gcov_intermediate_filename);
+		       gcov_intermediate_filename.c_str ());
 	      return;
 	    }
 	}
@@ -2546,15 +2590,6 @@ canonicalize_name (const char *name)
   return result;
 }
 
-/* Print hex representation of 16 bytes from SUM and write it to BUFFER.  */
-
-static void
-md5sum_to_hex (const char *sum, char *buffer)
-{
-  for (unsigned i = 0; i < 16; i++)
-    sprintf (buffer + (2 * i), "%02x", (unsigned char)sum[i]);
-}
-
 /* Generate an output file name. INPUT_NAME is the canonicalized main
    input file and SRC_NAME is the canonicalized file name.
    LONG_OUTPUT_NAMES and PRESERVE_PATHS affect name generation.  With
@@ -2567,77 +2602,42 @@ md5sum_to_hex (const char *sum, char *buffer)
    component.  (Remember, the canonicalized name will already have
    elided '.' components and converted \\ separators.)  */
 
-static char *
+static string
 make_gcov_file_name (const char *input_name, const char *src_name)
 {
-  char *ptr;
-  char *result;
-
-  if (flag_long_names && input_name && strcmp (src_name, input_name))
-    {
-      /* Generate the input filename part.  */
-      result = XNEWVEC (char, strlen (input_name) + strlen (src_name) + 10);
-
-      ptr = result;
-      ptr = mangle_name (input_name, ptr);
-      ptr[0] = ptr[1] = '#';
-      ptr += 2;
-    }
-  else
-    {
-      result = XNEWVEC (char, strlen (src_name) + 10);
-      ptr = result;
-    }
-
-  ptr = mangle_name (src_name, ptr);
-  strcpy (ptr, ".gcov");
+  string str;
 
   /* When hashing filenames, we shorten them by only using the filename
      component and appending a hash of the full (mangled) pathname.  */
   if (flag_hash_filenames)
+    str = (string (mangle_name (src_name)) + "##"
+	   + get_md5sum (src_name) + ".gcov");
+  else
     {
-      md5_ctx ctx;
-      char md5sum[16];
-      char md5sum_hex[33];
-
-      md5_init_ctx (&ctx);
-      md5_process_bytes (src_name, strlen (src_name), &ctx);
-      md5_finish_ctx (&ctx, md5sum);
-      md5sum_to_hex (md5sum, md5sum_hex);
-      free (result);
+      if (flag_long_names && input_name && strcmp (src_name, input_name) != 0)
+	{
+	  str += mangle_name (input_name);
+	  str += "##";
+	}
 
-      result = XNEWVEC (char, strlen (src_name) + 50);
-      ptr = result;
-      ptr = mangle_name (src_name, ptr);
-      ptr[0] = ptr[1] = '#';
-      ptr += 2;
-      memcpy (ptr, md5sum_hex, 32);
-      ptr += 32;
-      strcpy (ptr, ".gcov");
+      str += mangle_name (src_name);
+      str += ".gcov";
     }
 
-  return result;
+  return str;
 }
 
 /* Mangle BASE name, copy it at the beginning of PTR buffer and
    return address of the \0 character of the buffer.  */
 
 static char *
-mangle_name (char const *base, char *ptr)
+mangle_name (char const *base)
 {
-  size_t len;
-
   /* Generate the source filename part.  */
   if (!flag_preserve_paths)
-    base = lbasename (base);
+    return xstrdup (lbasename (base));
   else
-    base = mangle_path (base);
-
-  len = strlen (base);
-  memcpy (ptr, base, len);
-  ptr += len;
-
-  return ptr;
+    return mangle_path (base);
 }
 
 /* Scan through the bb_data for each line in the block, increment
-- 
2.32.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GCC 11 backports
  2021-08-23  8:54 ` Martin Liška
@ 2021-11-05 16:08   ` Martin Liška
  2021-11-08 12:26     ` Martin Liška
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Liška @ 2021-11-05 16:08 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 228 bytes --]

On 8/23/21 10:54, Martin Liška wrote:
> On 8/16/21 13:13, Martin Liška wrote:
>> I'm going to apply the following 3 tested patches.
>>
>> Martin
> 
> One more patch I've just tested.
> 
> Martin

And one more backport.

Martin

[-- Attachment #2: 0001-Speed-up-jump-table-switch-detection.patch --]
[-- Type: text/x-patch, Size: 5668 bytes --]

From 64fbc25cb6983725fefe313bfedd3657df795d54 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Fri, 13 Aug 2021 17:22:35 +0200
Subject: [PATCH] Speed up jump table switch detection.

	PR tree-optimization/100393

gcc/ChangeLog:

	* tree-switch-conversion.c (group_cluster::dump): Use
	  get_comparison_count.
	(jump_table_cluster::find_jump_tables): Pre-compute number of
	comparisons and then decrement it. Cache also max_ratio.
	(jump_table_cluster::can_be_handled): Change signature.
	* tree-switch-conversion.h (get_comparison_count): New.

(cherry picked from commit c517cf2e685e2903b591d63c1034ff9726cb3822)
---
 gcc/tree-switch-conversion.c | 42 ++++++++++++++++++++----------------
 gcc/tree-switch-conversion.h | 14 ++++++++++--
 2 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 7f65c4ce839..8fc5eaa3033 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1090,7 +1090,7 @@ group_cluster::dump (FILE *f, bool details)
   for (unsigned i = 0; i < m_cases.length (); i++)
     {
       simple_cluster *sc = static_cast<simple_cluster *> (m_cases[i]);
-      comparison_count += sc->m_range_p ? 2 : 1;
+      comparison_count += sc->get_comparison_count ();
     }
 
   unsigned HOST_WIDE_INT range = get_range (get_low (), get_high ());
@@ -1185,11 +1185,24 @@ jump_table_cluster::find_jump_tables (vec<cluster *> &clusters)
 
   min.quick_push (min_cluster_item (0, 0, 0));
 
+  unsigned HOST_WIDE_INT max_ratio
+    = (optimize_insn_for_size_p ()
+       ? param_jump_table_max_growth_ratio_for_size
+       : param_jump_table_max_growth_ratio_for_speed);
+
   for (unsigned i = 1; i <= l; i++)
     {
       /* Set minimal # of clusters with i-th item to infinite.  */
       min.quick_push (min_cluster_item (INT_MAX, INT_MAX, INT_MAX));
 
+      /* Pre-calculate number of comparisons for the clusters.  */
+      HOST_WIDE_INT comparison_count = 0;
+      for (unsigned k = 0; k <= i - 1; k++)
+	{
+	  simple_cluster *sc = static_cast<simple_cluster *> (clusters[k]);
+	  comparison_count += sc->get_comparison_count ();
+	}
+
       for (unsigned j = 0; j < i; j++)
 	{
 	  unsigned HOST_WIDE_INT s = min[j].m_non_jt_cases;
@@ -1200,10 +1213,15 @@ jump_table_cluster::find_jump_tables (vec<cluster *> &clusters)
 	  if ((min[j].m_count + 1 < min[i].m_count
 	       || (min[j].m_count + 1 == min[i].m_count
 		   && s < min[i].m_non_jt_cases))
-	      && can_be_handled (clusters, j, i - 1))
+	      && can_be_handled (clusters, j, i - 1, max_ratio,
+				 comparison_count))
 	    min[i] = min_cluster_item (min[j].m_count + 1, j, s);
+
+	  simple_cluster *sc = static_cast<simple_cluster *> (clusters[j]);
+	  comparison_count -= sc->get_comparison_count ();
 	}
 
+      gcc_checking_assert (comparison_count == 0);
       gcc_checking_assert (min[i].m_count != INT_MAX);
     }
 
@@ -1241,7 +1259,9 @@ jump_table_cluster::find_jump_tables (vec<cluster *> &clusters)
 
 bool
 jump_table_cluster::can_be_handled (const vec<cluster *> &clusters,
-				    unsigned start, unsigned end)
+				    unsigned start, unsigned end,
+				    unsigned HOST_WIDE_INT max_ratio,
+				    unsigned HOST_WIDE_INT comparison_count)
 {
   /* If the switch is relatively small such that the cost of one
      indirect jump on the target are higher than the cost of a
@@ -1260,10 +1280,6 @@ jump_table_cluster::can_be_handled (const vec<cluster *> &clusters,
   if (start == end)
     return true;
 
-  unsigned HOST_WIDE_INT max_ratio
-    = (optimize_insn_for_size_p ()
-       ? param_jump_table_max_growth_ratio_for_size
-       : param_jump_table_max_growth_ratio_for_speed);
   unsigned HOST_WIDE_INT range = get_range (clusters[start]->get_low (),
 					    clusters[end]->get_high ());
   /* Check overflow.  */
@@ -1277,18 +1293,6 @@ jump_table_cluster::can_be_handled (const vec<cluster *> &clusters,
   if (lhs < range)
     return false;
 
-  /* First make quick guess as each cluster
-     can add at maximum 2 to the comparison_count.  */
-  if (lhs > 2 * max_ratio * (end - start + 1))
-    return false;
-
-  unsigned HOST_WIDE_INT comparison_count = 0;
-  for (unsigned i = start; i <= end; i++)
-    {
-      simple_cluster *sc = static_cast<simple_cluster *> (clusters[i]);
-      comparison_count += sc->m_range_p ? 2 : 1;
-    }
-
   return lhs <= max_ratio * comparison_count;
 }
 
diff --git a/gcc/tree-switch-conversion.h b/gcc/tree-switch-conversion.h
index d76f19b57f6..a375e52636e 100644
--- a/gcc/tree-switch-conversion.h
+++ b/gcc/tree-switch-conversion.h
@@ -180,6 +180,13 @@ public:
     return tree_int_cst_equal (get_low (), get_high ());
   }
 
+  /* Return number of comparisons needed for the case.  */
+  unsigned
+  get_comparison_count ()
+  {
+    return m_range_p ? 2 : 1;
+  }
+
   /* Low value of the case.  */
   tree m_low;
 
@@ -267,9 +274,12 @@ public:
   static vec<cluster *> find_jump_tables (vec<cluster *> &clusters);
 
   /* Return true when cluster starting at START and ending at END (inclusive)
-     can build a jump-table.  */
+     can build a jump-table.  COMPARISON_COUNT is number of comparison
+     operations needed if the clusters are expanded as decision tree.
+     MAX_RATIO tells about the maximum code growth (in percent).  */
   static bool can_be_handled (const vec<cluster *> &clusters, unsigned start,
-			      unsigned end);
+			      unsigned end, unsigned HOST_WIDE_INT max_ratio,
+			      unsigned HOST_WIDE_INT comparison_count);
 
   /* Return true if cluster starting at START and ending at END (inclusive)
      is profitable transformation.  */
-- 
2.33.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GCC 11 backports
  2021-11-05 16:08   ` Martin Liška
@ 2021-11-08 12:26     ` Martin Liška
  2021-12-16 11:46       ` Martin Liška
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Liška @ 2021-11-08 12:26 UTC (permalink / raw)
  To: GCC Patches

On 11/5/21 17:08, Martin Liška wrote:
> On 8/23/21 10:54, Martin Liška wrote:
>> On 8/16/21 13:13, Martin Liška wrote:
>>> I'm going to apply the following 3 tested patches.
>>>
>>> Martin
>>
>> One more patch I've just tested.
>>
>> Martin
> 
> And one more backport.
> 
> Martin

One more tested patch.

Martin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GCC 11 backports
  2021-11-08 12:26     ` Martin Liška
@ 2021-12-16 11:46       ` Martin Liška
  2022-01-18 13:26         ` Martin Liška
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Liška @ 2021-12-16 11:46 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 411 bytes --]

On 11/8/21 13:26, Martin Liška wrote:
> On 11/5/21 17:08, Martin Liška wrote:
>> On 8/23/21 10:54, Martin Liška wrote:
>>> On 8/16/21 13:13, Martin Liška wrote:
>>>> I'm going to apply the following 3 tested patches.
>>>>
>>>> Martin
>>>
>>> One more patch I've just tested.
>>>
>>> Martin
>>
>> And one more backport.
>>
>> Martin
> 
> One more tested patch.
> 
> Martin

And one more tested patch.

Martin

[-- Attachment #2: 0001-i386-Fix-emissing-of-__builtin_cpu_supports.patch --]
[-- Type: text/x-patch, Size: 1429 bytes --]

From d4e305e4498039b921070418069a68648188b196 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Mon, 13 Dec 2021 15:34:30 +0100
Subject: [PATCH] i386: Fix emissing of __builtin_cpu_supports.

	PR target/103661

gcc/ChangeLog:

	* config/i386/i386-builtins.c (fold_builtin_cpu): Compare to 0
	as API expects that non-zero values are returned (do that
	it mask == 31).
	For "avx512vbmi2" argument, we return now 1 << 31, which is a
	negative integer value.

(cherry picked from commit 127c7178d5ec502d95862fd823537cbca1a0cb99)
---
 gcc/config/i386/i386-builtins.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/i386-builtins.c b/gcc/config/i386/i386-builtins.c
index 128bd39816c..59575aea795 100644
--- a/gcc/config/i386/i386-builtins.c
+++ b/gcc/config/i386/i386-builtins.c
@@ -2236,7 +2236,11 @@ fold_builtin_cpu (tree fndecl, tree *args)
       /* Return __cpu_model.__cpu_features[0] & field_val  */
       final = build2 (BIT_AND_EXPR, unsigned_type_node, array_elt,
 		      build_int_cstu (unsigned_type_node, field_val));
-      return build1 (CONVERT_EXPR, integer_type_node, final);
+      if (isa_names_table[i].feature == (INT_TYPE_SIZE - 1))
+	return build2 (NE_EXPR, integer_type_node, final,
+		       build_int_cst (unsigned_type_node, 0));
+      else
+	return build1 (CONVERT_EXPR, integer_type_node, final);
     }
   gcc_unreachable ();
 }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GCC 11 backports
  2021-12-16 11:46       ` Martin Liška
@ 2022-01-18 13:26         ` Martin Liška
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Liška @ 2022-01-18 13:26 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 502 bytes --]

On 12/16/21 12:46, Martin Liška wrote:
> On 11/8/21 13:26, Martin Liška wrote:
>> On 11/5/21 17:08, Martin Liška wrote:
>>> On 8/23/21 10:54, Martin Liška wrote:
>>>> On 8/16/21 13:13, Martin Liška wrote:
>>>>> I'm going to apply the following 3 tested patches.
>>>>>
>>>>> Martin
>>>>
>>>> One more patch I've just tested.
>>>>
>>>> Martin
>>>
>>> And one more backport.
>>>
>>> Martin
>>
>> One more tested patch.
>>
>> Martin
> 
> And one more tested patch.
> 
> Martin

One more patch.

Martin

[-- Attachment #2: 0001-ipa-naked-attribute-implies-noipa-attribute.patch --]
[-- Type: text/x-patch, Size: 1466 bytes --]

From b76e938a192da0da198d2f414070182f2506508d Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Thu, 12 Aug 2021 17:26:51 +0200
Subject: [PATCH] ipa: "naked" attribute implies "noipa" attribute

	PR ipa/101354

gcc/ChangeLog:

	* attribs.c (decl_attributes): Make naked functions "noipa"
	  functions.

(cherry picked from commit 4998404915bba9cb04c438a926cdf7126782a767)
---
 gcc/attribs.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/gcc/attribs.c b/gcc/attribs.c
index ebc0783c439..47969bd7742 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -520,14 +520,9 @@ decl_attributes (tree *node, tree attributes, int flags,
   if (TREE_CODE (*node) == FUNCTION_DECL
       && attributes
       && lookup_attribute ("naked", attributes) != NULL
-      && lookup_attribute_spec (get_identifier ("naked")))
-    {
-      if (lookup_attribute ("noinline", attributes) == NULL)
-	attributes = tree_cons (get_identifier ("noinline"), NULL, attributes);
-
-      if (lookup_attribute ("noclone", attributes) == NULL)
-	attributes = tree_cons (get_identifier ("noclone"),  NULL, attributes);
-    }
+      && lookup_attribute_spec (get_identifier ("naked"))
+      && lookup_attribute ("noipa", attributes) == NULL)
+	attributes = tree_cons (get_identifier ("noipa"), NULL, attributes);
 
   /* A "noipa" function attribute implies "noinline", "noclone" and "no_icf"
      for those targets that support it.  */
-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-18 13:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16 11:13 GCC 11 backports Martin Liška
2021-08-23  8:54 ` Martin Liška
2021-11-05 16:08   ` Martin Liška
2021-11-08 12:26     ` Martin Liška
2021-12-16 11:46       ` Martin Liška
2022-01-18 13:26         ` Martin Liška

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).