* [PATCH] Improve PR44479
@ 2010-07-04 16:06 Richard Guenther
0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2010-07-04 16:06 UTC (permalink / raw)
To: gcc-patches
Both the vectorizer and IVOPTs are still causing missed points-to
information at expansion time. This patch avoids more of the
causes - extra SSA name copies w/o points-to information.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2010-07-04 Richard Guenther <rguenther@suse.de>
PR tree-optimization/44479
* tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Avoid
extra SSA name copy statements which preserves points-to
information.
* tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref):
Copy points-to information for all pointers. Properly handle
MEM_REFs.
(vect_create_data_ref_ptr): Likewise. Avoid extra SSA name
copy statements.
* Makefile.in (tree-ssa-loop-ivopts.o): Add tree-ssa-propagate.h
dependency.
Index: gcc/tree-ssa-loop-ivopts.c
===================================================================
*** gcc/tree-ssa-loop-ivopts.c (revision 161797)
--- gcc/tree-ssa-loop-ivopts.c (working copy)
*************** along with GCC; see the file COPYING3.
*** 89,94 ****
--- 89,95 ----
#include "langhooks.h"
#include "tree-affine.h"
#include "target.h"
+ #include "tree-ssa-propagate.h"
/* FIXME: Expressions are expanded to RTL in this pass to determine the
cost of different addressing modes. This should be moved to a TBD
*************** rewrite_use_nonlinear_expr (struct ivopt
*** 5481,5492 ****
gcc_unreachable ();
}
! op = force_gimple_operand_gsi (&bsi, comp, false, SSA_NAME_VAR (tgt),
! true, GSI_SAME_STMT);
if (gimple_code (use->stmt) == GIMPLE_PHI)
{
! ass = gimple_build_assign (tgt, op);
gsi_insert_before (&bsi, ass, GSI_SAME_STMT);
bsi = gsi_for_stmt (use->stmt);
--- 5482,5499 ----
gcc_unreachable ();
}
! if (!valid_gimple_rhs_p (comp)
! || (gimple_code (use->stmt) != GIMPLE_PHI
! /* We can't allow re-allocating the stmt as it might be pointed
! to still. */
! && (get_gimple_rhs_num_ops (TREE_CODE (comp))
! >= gimple_num_ops (gsi_stmt (bsi)))))
! comp = force_gimple_operand_gsi (&bsi, comp, false, SSA_NAME_VAR (tgt),
! true, GSI_SAME_STMT);
if (gimple_code (use->stmt) == GIMPLE_PHI)
{
! ass = gimple_build_assign (tgt, comp);
gsi_insert_before (&bsi, ass, GSI_SAME_STMT);
bsi = gsi_for_stmt (use->stmt);
*************** rewrite_use_nonlinear_expr (struct ivopt
*** 5494,5500 ****
}
else
{
! gimple_assign_set_rhs_from_tree (&bsi, op);
use->stmt = gsi_stmt (bsi);
}
}
--- 5501,5507 ----
}
else
{
! gimple_assign_set_rhs_from_tree (&bsi, comp);
use->stmt = gsi_stmt (bsi);
}
}
Index: gcc/tree-vect-data-refs.c
===================================================================
*** gcc/tree-vect-data-refs.c (revision 161797)
--- gcc/tree-vect-data-refs.c (working copy)
*************** vect_create_addr_base_for_vector_ref (gi
*** 2787,2793 ****
vect_ptr_type = build_pointer_type (STMT_VINFO_VECTYPE (stmt_info));
base = get_base_address (DR_REF (dr));
if (base
! && INDIRECT_REF_P (base))
vect_ptr_type
= build_qualified_type (vect_ptr_type,
TYPE_QUALS (TREE_TYPE (TREE_OPERAND (base, 0))));
--- 2787,2793 ----
vect_ptr_type = build_pointer_type (STMT_VINFO_VECTYPE (stmt_info));
base = get_base_address (DR_REF (dr));
if (base
! && TREE_CODE (base) == MEM_REF)
vect_ptr_type
= build_qualified_type (vect_ptr_type,
TYPE_QUALS (TREE_TYPE (TREE_OPERAND (base, 0))));
*************** vect_create_addr_base_for_vector_ref (gi
*** 2799,2804 ****
--- 2799,2808 ----
vec_stmt = force_gimple_operand (vec_stmt, &seq, false, addr_expr);
gimple_seq_add_seq (new_stmt_list, seq);
+ if (DR_PTR_INFO (dr)
+ && TREE_CODE (vec_stmt) == SSA_NAME)
+ duplicate_ssa_name_ptr_info (vec_stmt, DR_PTR_INFO (dr));
+
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "created ");
*************** vect_create_data_ref_ptr (gimple stmt, s
*** 2934,2940 ****
vect_ptr_type = build_pointer_type (vectype);
base = get_base_address (DR_REF (dr));
if (base
! && INDIRECT_REF_P (base))
vect_ptr_type
= build_qualified_type (vect_ptr_type,
TYPE_QUALS (TREE_TYPE (TREE_OPERAND (base, 0))));
--- 2938,2944 ----
vect_ptr_type = build_pointer_type (vectype);
base = get_base_address (DR_REF (dr));
if (base
! && TREE_CODE (base) == MEM_REF)
vect_ptr_type
= build_qualified_type (vect_ptr_type,
TYPE_QUALS (TREE_TYPE (TREE_OPERAND (base, 0))));
*************** vect_create_data_ref_ptr (gimple stmt, s
*** 3032,3048 ****
*initial_address = new_temp;
/* Create: p = (vectype *) initial_base */
! vec_stmt = gimple_build_assign (vect_ptr,
! fold_convert (vect_ptr_type, new_temp));
! vect_ptr_init = make_ssa_name (vect_ptr, vec_stmt);
! gimple_assign_set_lhs (vec_stmt, vect_ptr_init);
! if (pe)
{
! new_bb = gsi_insert_on_edge_immediate (pe, vec_stmt);
! gcc_assert (!new_bb);
}
else
! gsi_insert_before (&gsi, vec_stmt, GSI_SAME_STMT);
/** (4) Handle the updating of the vector-pointer inside the loop.
This is needed when ONLY_INIT is false, and also when AT_LOOP
--- 3036,3061 ----
*initial_address = new_temp;
/* Create: p = (vectype *) initial_base */
! if (TREE_CODE (new_temp) != SSA_NAME
! || !useless_type_conversion_p (vect_ptr_type, TREE_TYPE (new_temp)))
{
! vec_stmt = gimple_build_assign (vect_ptr,
! fold_convert (vect_ptr_type, new_temp));
! vect_ptr_init = make_ssa_name (vect_ptr, vec_stmt);
! /* Copy the points-to information if it exists. */
! if (DR_PTR_INFO (dr))
! duplicate_ssa_name_ptr_info (vect_ptr_init, DR_PTR_INFO (dr));
! gimple_assign_set_lhs (vec_stmt, vect_ptr_init);
! if (pe)
! {
! new_bb = gsi_insert_on_edge_immediate (pe, vec_stmt);
! gcc_assert (!new_bb);
! }
! else
! gsi_insert_before (&gsi, vec_stmt, GSI_SAME_STMT);
}
else
! vect_ptr_init = new_temp;
/** (4) Handle the updating of the vector-pointer inside the loop.
This is needed when ONLY_INIT is false, and also when AT_LOOP
*************** vect_create_data_ref_ptr (gimple stmt, s
*** 3051,3062 ****
/* No update in loop is required. */
if (only_init && (!loop_vinfo || at_loop == loop))
! {
! /* Copy the points-to information if it exists. */
! if (DR_PTR_INFO (dr))
! duplicate_ssa_name_ptr_info (vect_ptr_init, DR_PTR_INFO (dr));
! vptr = vect_ptr_init;
! }
else
{
/* The step of the vector pointer is the Vector Size. */
--- 3064,3070 ----
/* No update in loop is required. */
if (only_init && (!loop_vinfo || at_loop == loop))
! vptr = vect_ptr_init;
else
{
/* The step of the vector pointer is the Vector Size. */
Index: gcc/Makefile.in
===================================================================
*** gcc/Makefile.in (revision 161797)
--- gcc/Makefile.in (working copy)
*************** c-family/c-common.o : c-family/c-common.
*** 2083,2089 ****
c-family/c-cppbuiltin.o : c-family/c-cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(TREE_H) version.h $(C_COMMON_H) $(C_PRAGMA_H) \
$(FLAGS_H) $(TOPLEV_H) output.h $(TREE_H) $(TARGET_H) \
! $(TM_P_H) $(BASEVER) debug.h $(CPP_ID_DATA_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
-DBASEVER=$(BASEVER_s) $< $(OUTPUT_OPTION)
--- 2083,2089 ----
c-family/c-cppbuiltin.o : c-family/c-cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(TREE_H) version.h $(C_COMMON_H) $(C_PRAGMA_H) \
$(FLAGS_H) $(TOPLEV_H) output.h $(TREE_H) $(TARGET_H) \
! $(TM_P_H) $(BASEVER) debug.h $(CPP_ID_DATA_H) gt-c-family-c-cppbuiltin.h
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
-DBASEVER=$(BASEVER_s) $< $(OUTPUT_OPTION)
*************** tree-ssa-loop-ivopts.o : tree-ssa-loop-i
*** 2566,2572 ****
$(TREE_PASS_H) $(GGC_H) $(RECOG_H) insn-config.h $(HASHTAB_H) $(SCEV_H) \
$(CFGLOOP_H) $(PARAMS_H) langhooks.h $(BASIC_BLOCK_H) \
tree-affine.h pointer-set.h $(TARGET_H) tree-pretty-print.h \
! gimple-pretty-print.h
tree-affine.o : tree-affine.c tree-affine.h $(CONFIG_H) pointer-set.h \
$(SYSTEM_H) $(TREE_H) $(GIMPLE_H) \
output.h $(DIAGNOSTIC_H) coretypes.h $(TREE_DUMP_H) $(FLAGS_H) \
--- 2566,2572 ----
$(TREE_PASS_H) $(GGC_H) $(RECOG_H) insn-config.h $(HASHTAB_H) $(SCEV_H) \
$(CFGLOOP_H) $(PARAMS_H) langhooks.h $(BASIC_BLOCK_H) \
tree-affine.h pointer-set.h $(TARGET_H) tree-pretty-print.h \
! gimple-pretty-print.h tree-ssa-propagate.h
tree-affine.o : tree-affine.c tree-affine.h $(CONFIG_H) pointer-set.h \
$(SYSTEM_H) $(TREE_H) $(GIMPLE_H) \
output.h $(DIAGNOSTIC_H) coretypes.h $(TREE_DUMP_H) $(FLAGS_H) \
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-07-04 16:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-04 16:06 [PATCH] Improve PR44479 Richard Guenther
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).