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 IVOPTs problem


Compiling gcc.c-torture/execute/20010910-1.c with IVOPTs enabled
leads to ssa verification failures because 
tree-ssa-loop-ivopts.c:rewrite_use does not update ssa form
(it calls update_stmt but misses mark_new_vars_to_rename).

The result is that we end up with the following before verify_ssa:

;; basic block 1, loop depth 1, count 0
;; prev block 0, next block 2
;; pred:       2 [100.0%]  (fallthru,exec) 0 [100.0%]  (fallthru,exec)
;; succ:       2 [80.0%]  (dfs_back,true,exec) 3 [20.0%]  
(loop_exit,false,exec)
# ivtmp.65_20 = PHI <ivtmp.65_5(2), 1(0)>;
# rx_ring_12 = PHI <rx_ring_42(2), rx_ring_7(0)>;
# SFT.3_19 = PHI <SFT.3_44(2), SFT.3_8(0)>;
<L0>:;
rx_ring.69_58 = (unsigned int *) &rx_ring;
D.1446_59 = (unsigned int *) ivtmp.65_20;
#   rx_ring_42 = V_MAY_DEF <rx_ring_12>;
MEM[base: rx_ring.69_58, index: D.1446_59, step: 4B, offset: -4B] = 0;
ep.70_60 = (unsigned int *) &ep;
D.1448_61 = (unsigned int *) ivtmp.65_20;
#   SFT.3_44 = V_MAY_DEF <SFT.3_19>;
#   SFT.4 = V_MAY_DEF <SFT.4>;
MEM[base: ep.70_60, index: D.1448_61, step: 4B] = 5;
ivtmp.65_5 = ivtmp.65_20 + 1;
if (ivtmp.65_5 != 6) goto <L20>; else goto <L21>;

where you can see that SFT.4 is not in SSA form.  The following
patch fixes this latent problem (which is uncovered very easily
by decomposing arrays to SFTs for aliasing).

Bootstrapped and tested on x86_64-unknown-linux-gnu, both with
and without the array aliasing patch.

Ok for mainline?

Thanks,
Richard.

:ADDPATCH:

2005-08-05  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-loop.c (pass_iv_optimize): Add TODO_update_ssa.
	* tree-ssa-loop-ivopts.c (rewrite_use): Mark new variables
	for renaming.

Index: tree-ssa-loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop.c,v
retrieving revision 2.33
diff -c -3 -p -r2.33 tree-ssa-loop.c
*** tree-ssa-loop.c	19 Jul 2005 00:44:45 -0000	2.33
--- tree-ssa-loop.c	5 Aug 2005 09:44:06 -0000
*************** struct tree_opt_pass pass_iv_optimize =
*** 435,441 ****
    0,					/* properties_provided */
    0,					/* properties_destroyed */
    0,					/* todo_flags_start */
!   TODO_dump_func | TODO_verify_loops,	/* todo_flags_finish */
    0					/* letter */
  };
  
--- 460,467 ----
    0,					/* properties_provided */
    0,					/* properties_destroyed */
    0,					/* todo_flags_start */
!   TODO_dump_func | TODO_verify_loops
!   | TODO_update_ssa,			/* todo_flags_finish */
    0					/* letter */
  };
  
Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
retrieving revision 2.86
diff -c -3 -p -r2.86 tree-ssa-loop-ivopts.c
*** tree-ssa-loop-ivopts.c	27 Jul 2005 13:26:55 -0000	2.86
--- tree-ssa-loop-ivopts.c	5 Aug 2005 09:44:06 -0000
*************** rewrite_use (struct ivopts_data *data,
*** 5755,5760 ****
--- 5770,5776 ----
  	gcc_unreachable ();
      }
    update_stmt (use->stmt);
+   mark_new_vars_to_rename (use->stmt);
  }
  
  /* Rewrite the uses using the selected induction variables.  */


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