This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] vectorizer: maintain location information, and ping
- From: Dorit Naishlos <DORIT at il dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Leehod Baruch <LEEHOD at il dot ibm dot com>
- Date: Mon, 31 Jan 2005 18:12:30 +0200
- Subject: [patch] vectorizer: maintain location information, and ping
- Reply-to:
- Sensitivity:
Following http://gcc.gnu.org/ml/gcc-patches/2005-01/msg00183.html, this is
a first step towards maintaining debug information in vectorized loops. In
this patch we copy location information from the original scalar stmt to
the vector stmt that replaces it.
This is the last patch in a series of patches that cleanup/improve the
vectorizer debug information:
(1) report correct loop line number information:
http://gcc.gnu.org/ml/gcc-patches/2005-01/msg00664.html
ok for mainline?
(2) add verbosity levels to vectorizer dump reports and cleanups:
http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01247.html
ok for mainline?
(3) (this patch) maintain location information for stmts.
In this patch we do not provide line number information for code created
outside of the vectorized loop. This includes:
1. setup code in the loop preheader for: (1) initialization of a vector
with a constant/invariant value, (2) mask calculation and extra load for
software-pipelined unaligned-load handling, (3) address calculation code,
including new IVs. These can get the location of the original scalar stmt
that prompted the creation of this code.
2. new code created by loop peeling (to align loop-bound or
memory-accesses) including new control code, new loops body, and setup code
before each loop to calculate number of iterations and such. The stmts in
the new peel-loops can get the location info of the original stmts they are
a duplicate of. The rest, maybe best left without location info.
Shall we prepare a patch for these cases too (for 4.0)? (comments on what's
the most appropriate thing to do in these cases are welcome).
Bootstrapped and tested on powerpc-darwin.
ok for mainline?
thanks,
dorit
Changelog:
* tree-vectorizer.c (slpeel_make_loop_iterate_ntimes): Copy
EXPR_LOCUS from orig_cond to the new cond_stmt.
(vect_finish_stmt_generation): Copy EXPR_LOCUS from stmt to
the new vec_stmt.
Patch:
--- tree-vectorizer.c.increment Mon Jan 31 10:28:45 2005
+++ tree-vectorizer.c.linenumber2 Mon Jan 31 11:05:03 2005
@@ -694,6 +694,12 @@ slpeel_make_loop_iterate_ntimes (struct
then_label, else_label);
bsi_insert_before (&loop_cond_bsi, cond_stmt, BSI_SAME_STMT);
+#ifdef USE_MAPPED_LOCATION
+ SET_EXPR_LOCATION (cond_stmt, EXPR_LOCUS (orig_cond));
+#else
+ SET_EXPR_LOCUS (cond_stmt, EXPR_LOCUS (orig_cond));
+#endif
+
/* Remove old loop exit test: */
bsi_remove (&loop_cond_bsi);
@@ -2446,6 +2452,12 @@ vect_finish_stmt_generation (tree stmt,
#ifdef ENABLE_CHECKING
/* Make sure bsi points to the stmt that is being vectorized. */
gcc_assert (stmt == bsi_stmt (*bsi));
+#endif
+
+#ifdef USE_MAPPED_LOCATION
+ SET_EXPR_LOCATION (vec_stmt, EXPR_LOCUS (stmt));
+#else
+ SET_EXPR_LOCUS (vec_stmt, EXPR_LOCUS (stmt));
#endif
}