This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA: fix PR rtl-optimization/20365


bootstrapped / regtested on i686-pc-linux-gnu.
2005-09-01  J"orn Rennecke <joern.rennecke@st.com>

	PR rtl-optimization/20365
	* simplify-rtx.c (simplify_plus_minus_op_data): Change type of neg
	to short.  New member ix.
	(simplify_plus_minus_op_data_cmp): Break ties using ix member.
	(simplify_plus_minus): Initialize ix members before calling qsort.

Index: simplify-rtx.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/simplify-rtx.c,v
retrieving revision 1.244
diff -p -r1.244 simplify-rtx.c
*** simplify-rtx.c	21 Aug 2005 13:27:50 -0000	1.244
--- simplify-rtx.c	1 Sep 2005 17:39:18 -0000
*************** simplify_const_binary_operation (enum rt
*** 2574,2580 ****
  struct simplify_plus_minus_op_data
  {
    rtx op;
!   int neg;
  };
  
  static int
--- 2574,2581 ----
  struct simplify_plus_minus_op_data
  {
    rtx op;
!   short neg;
!   short ix;
  };
  
  static int
*************** simplify_plus_minus_op_data_cmp (const v
*** 2582,2590 ****
  {
    const struct simplify_plus_minus_op_data *d1 = p1;
    const struct simplify_plus_minus_op_data *d2 = p2;
  
!   return (commutative_operand_precedence (d2->op)
! 	  - commutative_operand_precedence (d1->op));
  }
  
  static rtx
--- 2583,2595 ----
  {
    const struct simplify_plus_minus_op_data *d1 = p1;
    const struct simplify_plus_minus_op_data *d2 = p2;
+   int result;
  
!   result = (commutative_operand_precedence (d2->op)
! 	    - commutative_operand_precedence (d1->op));
!   if (result)
!     return result;
!   return d1->ix - d2->ix;
  }
  
  static rtx
*************** simplify_plus_minus (enum rtx_code code,
*** 2759,2765 ****
    /* Pack all the operands to the lower-numbered entries.  */
    for (i = 0, j = 0; j < n_ops; j++)
      if (ops[j].op)
!       ops[i++] = ops[j];
    n_ops = i;
  
    /* Sort the operations based on swap_commutative_operands_p.  */
--- 2764,2775 ----
    /* Pack all the operands to the lower-numbered entries.  */
    for (i = 0, j = 0; j < n_ops; j++)
      if (ops[j].op)
!       {
! 	ops[i] = ops[j];
! 	/* Stabilize sort.  */
! 	ops[i].ix = i;
! 	i++;
!       }
    n_ops = i;
  
    /* Sort the operations based on swap_commutative_operands_p.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]