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]

Re: [tree-ssa-lno] vectorizer patch.


In fact the problem comes from the following code:

  /* FORNOW: handle only cases where the loop bound divides by the
     vectorization factor. */

  DBG_VECT2 (fprintf (stderr, "vectorization_factor = %d, niters = %d\n",
   		      vectorization_factor,LOOP_VINFO_NITERS (loop_vinfo)));

  if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) ||
      LOOP_VINFO_NITERS (loop_vinfo) % vectorization_factor != 0)
    {
      DBG_VECT (fprintf (stderr,
      		"loop bound unknown or doesn't divide by %d\n", 
		vectorization_factor));
      return false;
    }

  return true;


which produces the following error:

[...]
-------
examining statement:
T.46_334 = i_10 + 1;

irrelevant
vectorization_factor = 0, niters = 16

Program received signal SIGFPE, Arithmetic exception.
0x08124bc7 in vect_analyze_operations (loop_vinfo=0x859e168) at ../../gcc/gcc/tree-vectorizer.c:1452
(gdb)


Because the statement is irrelevant, the vectorization_factor is not updated 
and remains equal to 0.  

Here is the patch that fixes this problem, and the testcase compiles with the 
anounced result:

vectorized 0 loops in function.
vectorized 0 loops in function.
vectorized 0 loops in function.
vectorized 5 loops in function.
vectorized 0 loops in function.
vectorized 0 loops in function.
vectorized 0 loops in function.


Index: tree-vectorizer.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-vectorizer.c,v
retrieving revision 1.1.2.2
diff -d -u -p -r1.1.2.2 tree-vectorizer.c
--- tree-vectorizer.c	2 Jan 2004 16:25:09 -0000	1.1.2.2
+++ tree-vectorizer.c	2 Jan 2004 22:26:53 -0000
@@ -1449,8 +1449,9 @@ vect_analyze_operations (loop_vec_info l
   DBG_VECT2 (fprintf (stderr, "vectorization_factor = %d, niters = %d\n",
    		      vectorization_factor,LOOP_VINFO_NITERS (loop_vinfo)));
 
-  if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) ||
-      LOOP_VINFO_NITERS (loop_vinfo) % vectorization_factor != 0)
+  if (vectorization_factor == 0
+      || !LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) 
+      || LOOP_VINFO_NITERS (loop_vinfo) % vectorization_factor != 0)
     {
       DBG_VECT (fprintf (stderr,
       		"loop bound unknown or doesn't divide by %d\n", 


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