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 outside-the-loop nest test bug in build_classic_dir/dist_vector


Dale J pointed out to me that the current test for whether a dependency is outside the loop nest isn't currently completely correct.
The correct test is whether the variables involved in *either* statements is outside the loop, not whether the variables involved in *both* statements are outside of the loop.
This was causing one last ICE in SPEC on darwin with -ftree-loop-linear.


This fixes that, and updates the comment to reflect the change, and adds the attached testcase to gcc.dg/tree-ssa

Bootstrapped and regtested on i686-pc-linux-gnu.

Okay for mainline?

2004-11-10 Daniel Berlin <dberlin@dberlin.org>

	* tree-data-ref.c (build_classic_dist_vector): If either loop
	is outside of the nest we asked about, the dependence can't
	matter.
	(build_classic_dir_vector): Ditto.

Index: tree-data-ref.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-data-ref.c,v
retrieving revision 2.15
diff -u -p -r2.15 tree-data-ref.c
--- tree-data-ref.c	1 Nov 2004 18:08:00 -0000	2.15
+++ tree-data-ref.c	10 Nov 2004 18:08:42 -0000
@@ -1816,12 +1816,12 @@ build_classic_dist_vector (struct data_d
 	  struct loop *loop_b = current_loops->parray[loop_nb_b];
 	  struct loop *loop_first = current_loops->parray[first_loop];

- /* If the loops for both variables are at a lower depth than - the first_loop's depth, then they can't possibly have a
+ /* If the loop for either variable is at a lower depth than + the first_loop's depth, then we can't possibly have a
dependency at this level of the loop. */


 	  if (loop_a->depth < loop_first->depth
-	      && loop_b->depth < loop_first->depth)
+	      || loop_b->depth < loop_first->depth)
 	    return false;

 	  if (loop_nb_a != loop_nb_b
@@ -1992,11 +1992,12 @@ build_classic_dir_vector (struct data_de
 	  struct loop *loop_b = current_loops->parray[loop_nb_b];
 	  struct loop *loop_first = current_loops->parray[first_loop];

- /* If the loops for both variables are at a lower depth than - the first_loop's depth, then they can't possibly matter */
+ /* If the loop for either variable is at a lower depth than + the first_loop's depth, then we can't possibly have a
+ dependency at this level of the loop. */


 	  if (loop_a->depth < loop_first->depth
-	      && loop_b->depth < loop_first->depth)
+	      || loop_b->depth < loop_first->depth)
 	    return false;

if (loop_nb_a != loop_nb_b

Attachment: 20041110-1.c
Description: Text document


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