public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-4364] Revert "ifcvt: replace C++ sort with vec::qsort [PR109154]"
@ 2023-10-02 13:25 Tamar Christina
  0 siblings, 0 replies; only message in thread
From: Tamar Christina @ 2023-10-02 13:25 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:bada3c27d855430af736de51439ce275cffda754

commit r14-4364-gbada3c27d855430af736de51439ce275cffda754
Author: Tamar Christina <tamar.christina@arm.com>
Date:   Mon Oct 2 14:23:59 2023 +0100

    Revert "ifcvt: replace C++ sort with vec::qsort [PR109154]"
    
    This reverts commit 19610580d49f3d2d8d511fba55b39efa0764dfc2.
    
    It broke bootstrap because of a recently added assert, and
    fixing will take time.

Diff:
---
 gcc/tree-if-conv.cc | 29 ++++++-----------------------
 1 file changed, 6 insertions(+), 23 deletions(-)

diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index 281984d0522..a8c915913ae 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -80,6 +80,7 @@ along with GCC; see the file COPYING3.  If not see
      <L18>:;
 */
 
+#define INCLUDE_ALGORITHM
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
@@ -2044,28 +2045,6 @@ gen_phi_nest_statement (gphi *phi, gimple_stmt_iterator *gsi,
   return lhs;
 }
 
-typedef std::pair <tree, std::pair <unsigned, unsigned>> ArgEntry;
-static int
-cmp_arg_entry (const void *p1, const void *p2)
-{
-  const ArgEntry sval1 = *(const ArgEntry *)p1;
-  const ArgEntry sval2 = *(const ArgEntry *)p2;
-  auto x1 = sval1.second;
-  auto x2 = sval2.second;
-
-  if (x1.first < x2.first)
-    return -1;
-  else if (x1.first > x2.first)
-    return 1;
-
-  if (x1.second < x2.second)
-    return -1;
-  else if (x1.second > x2.second)
-    return 1;
-
-  return 0;
-}
-
 /* Replace a scalar PHI node with a COND_EXPR using COND as condition.
    This routine can handle PHI nodes with more than two arguments.
 
@@ -2207,6 +2186,7 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi)
   /* Determine element with max number of occurrences and complexity.  Looking at only
      number of occurrences as a measure for complexity isn't enough as all usages can
      be unique but the comparisons to reach the PHI node differ per branch.  */
+  typedef std::pair <tree, std::pair <unsigned, unsigned>> ArgEntry;
   auto_vec<ArgEntry> argsKV;
   for (i = 0; i < args.length (); i++)
     {
@@ -2224,7 +2204,10 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi)
     }
 
   /* Sort elements based on rankings ARGS.  */
-  argsKV.qsort (cmp_arg_entry);
+  std::sort(argsKV.begin(), argsKV.end(), [](const ArgEntry &left,
+					     const ArgEntry &right) {
+    return left.second < right.second;
+  });
 
   for (i = 0; i < args.length (); i++)
     args[i] = argsKV[i].first;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-02 13:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-02 13:25 [gcc r14-4364] Revert "ifcvt: replace C++ sort with vec::qsort [PR109154]" Tamar Christina

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