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]

[PATCH] Fix PR rtl-optimization/24626 (P1 4.1/4.2 Regression)


This patch fixes PR 24626, reverting a patch that papered over a problem
on ppc while introducing another on hppa.

Bootstrapped and regtested on hppa-suse-linux-gnu (for C) and 
x86_64-unknown-linux-gnu.

Ok for mainline and branch?

Thanks,
Richard.

2006-01-16  Richard Guenther  <rguenther@suse.de>

	PR rtl-optimization/24626
	* cfgloopmanip.c (lv_adjust_loop_entry_edge): Don't set
	EDGE_TRUE_VALUE if in RTL mode.

	Revert
	2005-03-30 Mostafa Hagog <mustafa@il.ibm.com>
	* cfgrtl.c (rtl_verify_flow_info_1): Fix.

	* gcc.dg/torture/pr24626-1.c: New testcase.
	* gcc.dg/torture/pr24626-2.c: Likewise.
	* gcc.dg/torture/pr24626-3.c: Likewise.
	* gcc.dg/torture/pr24626-4.c: Likewise.

Index: cfgloopmanip.c
===================================================================
*** cfgloopmanip.c	(revision 109743)
--- cfgloopmanip.c	(working copy)
*************** lv_adjust_loop_entry_edge (basic_block f
*** 1419,1425 ****
    lv_add_condition_to_bb (first_head, second_head, new_head,
  			  cond_expr);
  
!   e1 = make_edge (new_head, first_head, EDGE_TRUE_VALUE);
    set_immediate_dominator (CDI_DOMINATORS, first_head, new_head);
    set_immediate_dominator (CDI_DOMINATORS, second_head, new_head);
  
--- 1419,1425 ----
    lv_add_condition_to_bb (first_head, second_head, new_head,
  			  cond_expr);
  
!   e1 = make_edge (new_head, first_head, ir_type () ? EDGE_TRUE_VALUE : 0);
    set_immediate_dominator (CDI_DOMINATORS, first_head, new_head);
    set_immediate_dominator (CDI_DOMINATORS, second_head, new_head);
  
Index: cfgrtl.c
===================================================================
*** cfgrtl.c	(revision 109743)
--- cfgrtl.c	(working copy)
*************** rtl_verify_flow_info_1 (void)
*** 2046,2054 ****
  	  err = 1;
  	}
        if (n_branch != 1 && any_condjump_p (BB_END (bb))
! 	  && JUMP_LABEL (BB_END (bb)) == BB_HEAD (fallthru->dest))
  	{
! 	  error ("wrong amount of branch edges after conditional jump %i", bb->index);
  	  err = 1;
  	}
        if (n_call && !CALL_P (BB_END (bb)))
--- 2046,2055 ----
  	  err = 1;
  	}
        if (n_branch != 1 && any_condjump_p (BB_END (bb))
! 	  && JUMP_LABEL (BB_END (bb)) != BB_HEAD (fallthru->dest))
  	{
! 	  error ("wrong amount of branch edges after conditional jump %i",
! 		 bb->index);
  	  err = 1;
  	}
        if (n_call && !CALL_P (BB_END (bb)))
Index: testsuite/gcc.dg/torture/pr24626-1.c
===================================================================
*** testsuite/gcc.dg/torture/pr24626-1.c	(revision 0)
--- testsuite/gcc.dg/torture/pr24626-1.c	(revision 0)
***************
*** 0 ****
--- 1,28 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O2" } */
+ 
+ typedef long
+ (*bla)(int *node);
+ 
+ static long F2(void *tree, long blk, bla after_node_func)
+ {
+  long call_result = 0;
+  int *node;
+ 
+ 
+  if (call_result = after_node_func(node))
+   goto error_free_node;
+ 
+  T(node);
+  return 0;
+ 
+ error_free_node:
+  T(node);
+ error:
+  return call_result;
+ }
+ 
+ long F1(void *tree)
+ {
+  return F2(tree, F3(tree), (void *)0);
+ }
Index: testsuite/gcc.dg/torture/pr24626-2.c
===================================================================
*** testsuite/gcc.dg/torture/pr24626-2.c	(revision 0)
--- testsuite/gcc.dg/torture/pr24626-2.c	(revision 0)
***************
*** 0 ****
--- 1,55 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O2" } */
+ 
+ typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
+ typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
+ typedef u_int32_t db_pgno_t;
+ typedef struct __db DB;
+ typedef struct __db_env DB_ENV;
+ typedef struct __db_mpoolfile DB_MPOOLFILE;
+ typedef struct __dbc DBC;
+ struct __db {
+     DB_MPOOLFILE *mpf;
+     db_pgno_t meta_pgno;
+     struct __cq_aq {
+     } s_links;
+ };
+ struct __db_env {
+     struct {
+     } xa_txn;
+     u_int32_t flags;
+ };
+ typedef enum { MU_REMOVE, MU_RENAME, MU_OPEN } mu_action;
+ typedef struct __dbpginfo {
+     u_int8_t type;
+ } PAGE;
+ int __db_master_update(mdbp, sdbp, txn, subdb, type, action, newname, flags)
+   DB *mdbp, *sdbp;
+ {
+     DB_ENV *dbenv;
+     DBC *dbc, *ndbc;
+     PAGE *p, *r;
+     int modify, ret, t_ret;
+     if ((ret = __db_cursor(mdbp, txn, &dbc,
+ 			   (((dbenv)->flags & (0x0000002))
+ 			    && modify) ? 35 : 0)) != 0)
+ 	goto err;
+     switch (action) {
+ 	case MU_REMOVE:
+ 	    if ((ret = __memp_fget(mdbp->mpf, &sdbp->meta_pgno, 0, &p)) != 0)
+ 		goto err;
+ 	    if ((((PAGE *)p)->type) == 9) {
+ 		if ((ret = __db_free(dbc, r)) != 0) { }
+ 	    }
+ 	    if ((ret = __db_free(dbc, p)) != 0) {
+ 		p = ((void *)0);
+ 		goto err;
+ 	    }
+ 	    p = ((void *)0);
+     }
+  err:
+     if (ndbc != ((void *)0) && (t_ret = __db_c_close(ndbc)) != 0 && ret == 0)
+ 	ret = t_ret;
+     return (ret);
+ }
+  
Index: testsuite/gcc.dg/torture/pr24626-3.c
===================================================================
*** testsuite/gcc.dg/torture/pr24626-3.c	(revision 0)
--- testsuite/gcc.dg/torture/pr24626-3.c	(revision 0)
***************
*** 0 ****
--- 1,19 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O2" } */
+ 
+ long fff(int*);
+ 
+ long F2(int *node)
+ {
+  long call_result = 0;
+ 
+  if (call_result = fff(node))
+   goto error_free_node;
+ 
+  T(node);
+  return 0;
+ 
+ error_free_node:
+  T(node);
+  return call_result;
+ }
Index: testsuite/gcc.dg/torture/pr24626-4.c
===================================================================
*** testsuite/gcc.dg/torture/pr24626-4.c	(revision 0)
--- testsuite/gcc.dg/torture/pr24626-4.c	(revision 0)
***************
*** 0 ****
--- 1,12 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O -fmodulo-sched" } */
+ 
+ int foo(short* vec1, short* vec2, short* vec3,int len )
+ {
+         int temp,i;
+         for (i=0; i<len; i++) {
+                  temp = vec1[i] * 2;
+                  temp += vec2[i] * 3 ;
+                  vec3[i] = temp;
+         }
+ }


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