From: Ira Rosen <IRAR@il.ibm.com>
To: gcc-patches@gnu.org
Subject: [patch] Remove redundant calls to copy_virtual_operands
Date: Tue, 07 Aug 2007 12:10:00 -0000 [thread overview]
Message-ID: <OF930B00A8.8262D5E2-ONC2257330.0032AB21-C2257330.0042B670@il.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 899 bytes --]
Currently the vectorizer copies virtual operands from scalar memory
operations to the corresponding vector operations (that the vectorizer
creates). This seems to be redundant, since we set memory tags for the
memory operations that we create and call update_ssa at the end of loop
vectorization. This patch removes these redundant calls to
copy_virtual_operands().
Bootstrapped and tested on ppc-linux and x86_64-linux.
O.K. for mainline?
Ira
:ADDPATCH SSA:
ChangeLog entry:
* tree-vect-transform.c (vectorizable_store): Remove call to
copy_virtual_operands() and call mark_symbols_for_renaming() for
the created vector store.
(vect_setup_realignment): Don't call copy_virtual_operands() and
update_vuses_to_preheader().
(vectorizable_load): Don't call copy_virtual_operands().
(update_vuses_to_preheader): Remove.
(See attached file: copy_vops.txt)
[-- Attachment #2: copy_vops.txt --]
[-- Type: text/plain, Size: 5948 bytes --]
--- tree-vect-transform.c 2007-08-06 18:15:44.000000000 +0300
+++ tree-vect-transform.c 2007-08-07 15:12:48.000000000 +0300
@@ -58,7 +58,6 @@ static tree vect_init_vector (tree, tree
static void vect_finish_stmt_generation
(tree stmt, tree vec_stmt, block_stmt_iterator *bsi);
static bool vect_is_simple_cond (tree, loop_vec_info);
-static void update_vuses_to_preheader (tree, struct loop*);
static void vect_create_epilog_for_reduction (tree, tree, enum tree_code, tree);
static tree get_initial_def_for_reduction (tree, tree, tree *);
@@ -3871,8 +3870,6 @@ vectorizable_store (tree stmt, block_stm
enum machine_mode vec_mode;
tree dummy;
enum dr_alignment_support alignment_support_cheme;
- ssa_op_iter iter;
- def_operand_p def_p;
tree def, def_stmt;
enum vect_def_type dt;
stmt_vec_info prev_stmt_info = NULL;
@@ -4089,36 +4086,12 @@ vectorizable_store (tree stmt, block_stm
/* Arguments are ready. Create the new vector stmt. */
new_stmt = build_gimple_modify_stmt (data_ref, vec_oprnd);
vect_finish_stmt_generation (stmt, new_stmt, bsi);
-
- /* Set the VDEFs for the vector pointer. If this virtual def
- has a use outside the loop and a loop peel is performed
- then the def may be renamed by the peel. Mark it for
- renaming so the later use will also be renamed. */
- copy_virtual_operands (new_stmt, next_stmt);
- if (j == 0)
- {
- /* The original store is deleted so the same SSA_NAMEs
- can be used. */
- FOR_EACH_SSA_TREE_OPERAND (def, next_stmt, iter, SSA_OP_VDEF)
- {
- SSA_NAME_DEF_STMT (def) = new_stmt;
- mark_sym_for_renaming (SSA_NAME_VAR (def));
- }
-
- STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt;
- }
+ mark_symbols_for_renaming (new_stmt);
+
+ if (j == 0)
+ STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt;
else
- {
- /* Create new names for all the definitions created by COPY and
- add replacement mappings for each new name. */
- FOR_EACH_SSA_DEF_OPERAND (def_p, new_stmt, iter, SSA_OP_VDEF)
- {
- create_new_def_for (DEF_FROM_PTR (def_p), new_stmt, def_p);
- mark_sym_for_renaming (SSA_NAME_VAR (DEF_FROM_PTR (def_p)));
- }
-
- STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
- }
+ STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt;
prev_stmt_info = vinfo_for_stmt (new_stmt);
next_stmt = DR_GROUP_NEXT_DR (vinfo_for_stmt (next_stmt));
@@ -4204,8 +4177,6 @@ vect_setup_realignment (tree stmt, block
new_bb = bsi_insert_on_edge_immediate (pe, new_stmt);
gcc_assert (!new_bb);
msq_init = GIMPLE_STMT_OPERAND (new_stmt, 0);
- copy_virtual_operands (new_stmt, stmt);
- update_vuses_to_preheader (new_stmt, loop);
/* 2. Create permutation mask, if required, in loop preheader. */
if (targetm.vectorize.builtin_mask_for_load)
@@ -4780,7 +4751,6 @@ vectorizable_load (tree stmt, block_stmt
new_temp = make_ssa_name (vec_dest, new_stmt);
GIMPLE_STMT_OPERAND (new_stmt, 0) = new_temp;
vect_finish_stmt_generation (stmt, new_stmt, bsi);
- copy_virtual_operands (new_stmt, stmt);
mark_symbols_for_renaming (new_stmt);
/* 3. Handle explicit realignment if necessary/supported. */
@@ -5273,82 +5243,6 @@ vect_generate_tmps_on_preheader (loop_ve
}
-/* Function update_vuses_to_preheader.
-
- Input:
- STMT - a statement with potential VUSEs.
- LOOP - the loop whose preheader will contain STMT.
-
- It's possible to vectorize a loop even though an SSA_NAME from a VUSE
- appears to be defined in a VDEF in another statement in a loop.
- One such case is when the VUSE is at the dereference of a __restricted__
- pointer in a load and the VDEF is at the dereference of a different
- __restricted__ pointer in a store. Vectorization may result in
- copy_virtual_uses being called to copy the problematic VUSE to a new
- statement that is being inserted in the loop preheader. This procedure
- is called to change the SSA_NAME in the new statement's VUSE from the
- SSA_NAME updated in the loop to the related SSA_NAME available on the
- path entering the loop.
-
- When this function is called, we have the following situation:
-
- # vuse <name1>
- S1: vload
- do {
- # name1 = phi < name0 , name2>
-
- # vuse <name1>
- S2: vload
-
- # name2 = vdef <name1>
- S3: vstore
-
- }while...
-
- Stmt S1 was created in the loop preheader block as part of misaligned-load
- handling. This function fixes the name of the vuse of S1 from 'name1' to
- 'name0'. */
-
-static void
-update_vuses_to_preheader (tree stmt, struct loop *loop)
-{
- basic_block header_bb = loop->header;
- edge preheader_e = loop_preheader_edge (loop);
- ssa_op_iter iter;
- use_operand_p use_p;
-
- FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_VUSE)
- {
- tree ssa_name = USE_FROM_PTR (use_p);
- tree def_stmt = SSA_NAME_DEF_STMT (ssa_name);
- tree name_var = SSA_NAME_VAR (ssa_name);
- basic_block bb = bb_for_stmt (def_stmt);
-
- /* For a use before any definitions, def_stmt is a NOP_EXPR. */
- if (!IS_EMPTY_STMT (def_stmt)
- && flow_bb_inside_loop_p (loop, bb))
- {
- /* If the block containing the statement defining the SSA_NAME
- is in the loop then it's necessary to find the definition
- outside the loop using the PHI nodes of the header. */
- tree phi;
- bool updated = false;
-
- for (phi = phi_nodes (header_bb); phi; phi = PHI_CHAIN (phi))
- {
- if (SSA_NAME_VAR (PHI_RESULT (phi)) == name_var)
- {
- SET_USE (use_p, PHI_ARG_DEF (phi, preheader_e->dest_idx));
- updated = true;
- break;
- }
- }
- gcc_assert (updated);
- }
- }
-}
-
-
/* Function vect_update_ivs_after_vectorizer.
"Advance" the induction variables of LOOP to the value they should take
next reply other threads:[~2007-08-07 12:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-07 12:10 Ira Rosen [this message]
2007-08-07 13:06 ` Dorit Nuzman
2007-08-07 13:23 ` Diego Novillo
2007-08-08 8:02 ` Ira Rosen
2007-08-08 12:06 ` Diego Novillo
2007-08-08 9:41 ` Zdenek Dvorak
2007-08-08 11:04 ` Ira Rosen
2007-08-12 19:40 ` Zdenek Dvorak
2007-08-07 13:22 ` Diego Novillo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=OF930B00A8.8262D5E2-ONC2257330.0032AB21-C2257330.0042B670@il.ibm.com \
--to=irar@il.ibm.com \
--cc=gcc-patches@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).