This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
bug in tree-vect-analyze.c
- From: Andrew MacLeod <amacleod at redhat dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: dorit at il dot ibm dot com
- Date: Thu, 14 Apr 2005 17:08:56 -0400
- Subject: bug in tree-vect-analyze.c
I've found a serious bug in function
tree-vect-analyze::vect_stmt_relevant_p That I believe I have introduced
with the immediate uses change:
some pending new operand changes caught this...
I'll run it through bootstrap and everything before submitting the real
patch, I just figured I would let you know now that I have stumbled
across it.
It just failed silently before. We weren't processing the immediate uses
of any PHI node in this routine. Im sure that isnt a good thing :-|
Andrew
* tree-vect-analyze.c (vect_stmt_relevant_p): Process imm_uses for
PHIs.
Index: tree-vect-analyze.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vect-analyze.c,v
retrieving revision 2.19
diff -c -p -r2.19 tree-vect-analyze.c
*** tree-vect-analyze.c 12 Apr 2005 01:35:48 -0000 2.19
--- tree-vect-analyze.c 14 Apr 2005 21:06:24 -0000
*************** vect_stmt_relevant_p (tree stmt, loop_ve
*** 2126,2141 ****
return true;
/* changing memory. */
! if (TREE_CODE (stmt) != PHI_NODE)
{
! v_may_defs = STMT_V_MAY_DEF_OPS (stmt);
! v_must_defs = STMT_V_MUST_DEF_OPS (stmt);
! if (v_may_defs || v_must_defs)
{
! if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
! fprintf (vect_dump, "vec_stmt_relevant_p: stmt has vdefs.");
! return true;
}
}
/* uses outside the loop. */
--- 2126,2153 ----
return true;
/* changing memory. */
! if (TREE_CODE (stmt) == PHI_NODE)
{
! FOR_EACH_IMM_USE_FAST (use_p, imm_iter, PHI_RESULT (stmt))
{
! basic_block bb = bb_for_stmt (USE_STMT (use_p));
! if (!flow_bb_inside_loop_p (loop, bb))
! {
! if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
! fprintf (vect_dump, "vec_stmt_relevant_p: used out of loop.");
! return true;
! }
}
+ return false;
+ }
+
+ v_may_defs = STMT_V_MAY_DEF_OPS (stmt);
+ v_must_defs = STMT_V_MUST_DEF_OPS (stmt);
+ if (v_may_defs || v_must_defs)
+ {
+ if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
+ fprintf (vect_dump, "vec_stmt_relevant_p: stmt has vdefs.");
+ return true;
}
/* uses outside the loop. */