------- Comment #6 from dorit at gcc dot gnu dot org  2007-10-22 04:28 -------
I'm testing this patch. It fixes the two testcases, while allowing the first
testcase to get vectorized. (the last bit in the patch is the fix for PR33835):

Index: tree-vect-analyze.c
===================================================================
*** tree-vect-analyze.c (revision 129521)
--- tree-vect-analyze.c (working copy)
*************** vect_analyze_operations (loop_vec_info l
*** 481,487 ****
              need_to_vectorize = true;
            }

!         ok = (vectorizable_type_promotion (stmt, NULL, NULL)
                || vectorizable_type_demotion (stmt, NULL, NULL)
                || vectorizable_conversion (stmt, NULL, NULL, NULL)
                || vectorizable_operation (stmt, NULL, NULL, NULL)
--- 481,489 ----
              need_to_vectorize = true;
            }

!         if (STMT_VINFO_RELEVANT_P (stmt_info)
!             || STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def)
!           ok = (vectorizable_type_promotion (stmt, NULL, NULL)
                || vectorizable_type_demotion (stmt, NULL, NULL)
                || vectorizable_conversion (stmt, NULL, NULL, NULL)
                || vectorizable_operation (stmt, NULL, NULL, NULL)
*************** vect_analyze_operations (loop_vec_info l
*** 492,508 ****
                || vectorizable_condition (stmt, NULL, NULL)
                || vectorizable_reduction (stmt, NULL, NULL));

          /* Stmts that are (also) "live" (i.e. - that are used out of the
loop)
             need extra handling, except for vectorizable reductions.  */
          if (STMT_VINFO_LIVE_P (stmt_info)
              && STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type)
!           ok |= vectorizable_live_operation (stmt, NULL, NULL);

          if (!ok)
            {
              if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
                {
!                 fprintf (vect_dump, "not vectorized: stmt not supported: ");
                  print_generic_expr (vect_dump, stmt, TDF_SLIM);
                }
              return false;
--- 494,522 ----
                || vectorizable_condition (stmt, NULL, NULL)
                || vectorizable_reduction (stmt, NULL, NULL));

+         if (!ok)
+           {
+             if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+               {
+                 fprintf (vect_dump, "not vectorized: relevant stmt not ");
+                 fprintf (vect_dump, "supported: ");
+                 print_generic_expr (vect_dump, stmt, TDF_SLIM);
+               }
+             return false;
+           }
+ 
          /* Stmts that are (also) "live" (i.e. - that are used out of the
loop)
             need extra handling, except for vectorizable reductions.  */
          if (STMT_VINFO_LIVE_P (stmt_info)
              && STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type)
!           ok = vectorizable_live_operation (stmt, NULL, NULL);

          if (!ok)
            {
              if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
                {
!                 fprintf (vect_dump, "not vectorized: live stmt not ");
!                 fprintf (vect_dump, "supported: ");
                  print_generic_expr (vect_dump, stmt, TDF_SLIM);
                }
              return false;
Index: tree-vect-transform.c
===================================================================
*** tree-vect-transform.c       (revision 129521)
--- tree-vect-transform.c       (working copy)
*************** vectorizable_call (tree stmt, block_stmt
*** 2961,2974 ****
    if (STMT_SLP_TYPE (stmt_info))
      return false;

-   /* FORNOW: not yet supported.  */
-   if (STMT_VINFO_LIVE_P (stmt_info))
-     {
-       if (vect_print_dump_info (REPORT_DETAILS))
-         fprintf (vect_dump, "value used after loop.");
-       return false;
-     }
-
    /* Is STMT a vectorizable call?   */
    if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
      return false;
--- 2961,2966 ----
*************** vectorizable_conversion (tree stmt, bloc
*** 3307,3320 ****
    if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
      return false;

-   if (STMT_VINFO_LIVE_P (stmt_info))
-     {
-       /* FORNOW: not yet supported.  */
-       if (vect_print_dump_info (REPORT_DETAILS))
-       fprintf (vect_dump, "value used after loop.");
-       return false;
-     }
- 
    if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
      return false;

--- 3299,3304 ----
*************** vectorizable_assignment (tree stmt, bloc
*** 3585,3598 ****
    if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
      return false;

-   /* FORNOW: not yet supported.  */
-   if (STMT_VINFO_LIVE_P (stmt_info))
-     {
-       if (vect_print_dump_info (REPORT_DETAILS))
-         fprintf (vect_dump, "value used after loop.");
-       return false;
-     }
- 
    /* Is vectorizable assignment?  */
    if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
      return false;
--- 3569,3574 ----
*************** vectorizable_induction (tree phi, block_
*** 3702,3715 ****

    gcc_assert (STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def);

-   if (STMT_VINFO_LIVE_P (stmt_info))
-     {
-       /* FORNOW: not yet supported.  */
-       if (vect_print_dump_info (REPORT_DETAILS))
-         fprintf (vect_dump, "value used after loop.");
-       return false;
-     }
- 
    if (TREE_CODE (phi) != PHI_NODE)
      return false;

--- 3678,3683 ----
*************** vectorizable_operation (tree stmt, block
*** 3791,3804 ****
    if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
      return false;

-   /* FORNOW: not yet supported.  */
-   if (STMT_VINFO_LIVE_P (stmt_info))
-     {
-       if (vect_print_dump_info (REPORT_DETAILS))
-         fprintf (vect_dump, "value used after loop.");
-       return false;
-     }
-
    /* Is STMT a vectorizable binary/unary operation?   */
    if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
      return false;
--- 3759,3764 ----
*************** vectorizable_type_demotion (tree stmt, b
*** 4088,4101 ****
    if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
      return false;

-   /* FORNOW: not yet supported.  */
-   if (STMT_VINFO_LIVE_P (stmt_info))
-     {
-       if (vect_print_dump_info (REPORT_DETAILS))
-         fprintf (vect_dump, "value used after loop.");
-       return false;
-     }
- 
    /* Is STMT a vectorizable type-demotion operation?  */
    if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
      return false;
--- 4048,4053 ----
*************** vectorizable_type_promotion (tree stmt, 
*** 4249,4262 ****
    if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
      return false;

-   /* FORNOW: not yet supported.  */
-   if (STMT_VINFO_LIVE_P (stmt_info))
-     {
-       if (vect_print_dump_info (REPORT_DETAILS))
-         fprintf (vect_dump, "value used after loop.");
-       return false;
-     }
- 
    /* Is STMT a vectorizable type-promotion operation?  */
    if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
      return false;
--- 4201,4206 ----
*************** vectorizable_store (tree stmt, block_stm
*** 4629,4641 ****
    if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
      return false;

-   if (STMT_VINFO_LIVE_P (stmt_info))
-     {
-       if (vect_print_dump_info (REPORT_DETAILS))
-         fprintf (vect_dump, "value used after loop.");
-       return false;
-     }
- 
    /* Is vectorizable store? */

    if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
--- 4573,4578 ----
*************** vectorizable_load (tree stmt, block_stmt
*** 5458,5471 ****
    if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
      return false;

-   /* FORNOW: not yet supported.  */
-   if (STMT_VINFO_LIVE_P (stmt_info))
-     {
-       if (vect_print_dump_info (REPORT_DETAILS))
-         fprintf (vect_dump, "value used after loop.");
-       return false;
-     }
- 
    /* Is vectorizable load? */
    if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
      return false;
--- 5395,5400 ----
*************** vectorizable_live_operation (tree stmt,
*** 5893,5899 ****
    for (i = 0; i < op_type; i++)
      {
        op = TREE_OPERAND (operation, i);
!       if (!vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt))
          {
            if (vect_print_dump_info (REPORT_DETAILS))
              fprintf (vect_dump, "use not simple.");
--- 5822,5828 ----
    for (i = 0; i < op_type; i++)
      {
        op = TREE_OPERAND (operation, i);
!       if (op && !vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt))
          {
            if (vect_print_dump_info (REPORT_DETAILS))
              fprintf (vect_dump, "use not simple.");


-- 

dorit at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |dorit at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-10-22 04:28:31
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33834

Reply via email to