From: Richard Biener Date: Tue, 3 Jul 2018 09:39:59 +0000 (+0000) Subject: tree-vect-stmts.c (vect_is_simple_use): Consolidate dumping, always set *dt. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=30f502eddecac8ecfbec4b86f3a80f1859076b6d;p=gcc.git tree-vect-stmts.c (vect_is_simple_use): Consolidate dumping, always set *dt. 2018-07-03 Richard Biener * tree-vect-stmts.c (vect_is_simple_use): Consolidate dumping, always set *dt. Dump vectype in vectype overload. * dumpfile.h (dump_gimple_expr): New function. (dump_gimple_expr_loc): Likewise. * dumpfile.c (dump_gimple_expr): New function. (dump_gimple_expr_loc): Likewise. From-SVN: r262330 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a1f2d351983..99226d5861f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2018-07-03 Richard Biener + + * tree-vect-stmts.c (vect_is_simple_use): Consolidate dumping, + always set *dt. Dump vectype in vectype overload. + * dumpfile.h (dump_gimple_expr): New function. + (dump_gimple_expr_loc): Likewise. + * dumpfile.c (dump_gimple_expr): New function. + (dump_gimple_expr_loc): Likewise. + 2018-07-02 Jeff Law * config/h8300/h8300.md (movqi_h8300, movqi_h8300hs): Consolidate diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c index 5f69f9bd646..3296299e86b 100644 --- a/gcc/dumpfile.c +++ b/gcc/dumpfile.c @@ -492,6 +492,42 @@ dump_gimple_stmt_loc (dump_flags_t dump_kind, const dump_location_t &loc, } } +/* Dump gimple statement GS with SPC indentation spaces and + EXTRA_DUMP_FLAGS on the dump streams if DUMP_KIND is enabled. + Do not terminate with a newline or semicolon. */ + +void +dump_gimple_expr (dump_flags_t dump_kind, dump_flags_t extra_dump_flags, + gimple *gs, int spc) +{ + if (dump_file && (dump_kind & pflags)) + print_gimple_expr (dump_file, gs, spc, dump_flags | extra_dump_flags); + + if (alt_dump_file && (dump_kind & alt_flags)) + print_gimple_expr (alt_dump_file, gs, spc, dump_flags | extra_dump_flags); +} + +/* Similar to dump_gimple_expr, except additionally print source location. */ + +void +dump_gimple_expr_loc (dump_flags_t dump_kind, const dump_location_t &loc, + dump_flags_t extra_dump_flags, gimple *gs, int spc) +{ + location_t srcloc = loc.get_location_t (); + if (dump_file && (dump_kind & pflags)) + { + dump_loc (dump_kind, dump_file, srcloc); + print_gimple_expr (dump_file, gs, spc, dump_flags | extra_dump_flags); + } + + if (alt_dump_file && (dump_kind & alt_flags)) + { + dump_loc (dump_kind, alt_dump_file, srcloc); + print_gimple_expr (alt_dump_file, gs, spc, dump_flags | extra_dump_flags); + } +} + + /* Dump expression tree T using EXTRA_DUMP_FLAGS on dump streams if DUMP_KIND is enabled. */ diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h index 0e588a6dac6..a4172419c1d 100644 --- a/gcc/dumpfile.h +++ b/gcc/dumpfile.h @@ -431,6 +431,9 @@ extern void dump_generic_expr (dump_flags_t, dump_flags_t, tree); extern void dump_gimple_stmt_loc (dump_flags_t, const dump_location_t &, dump_flags_t, gimple *, int); extern void dump_gimple_stmt (dump_flags_t, dump_flags_t, gimple *, int); +extern void dump_gimple_expr_loc (dump_flags_t, const dump_location_t &, + dump_flags_t, gimple *, int); +extern void dump_gimple_expr (dump_flags_t, dump_flags_t, gimple *, int); extern void print_combine_total_stats (void); extern bool enable_rtl_dump_file (void); diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index ab8cc8049a4..ae62fc36401 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -10036,61 +10036,53 @@ vect_is_simple_use (tree operand, vec_info *vinfo, enum vect_def_type *dt, { dump_printf_loc (MSG_NOTE, vect_location, "vect_is_simple_use: operand "); - dump_generic_expr (MSG_NOTE, TDF_SLIM, operand); - dump_printf (MSG_NOTE, "\n"); + if (TREE_CODE (operand) == SSA_NAME + && !SSA_NAME_IS_DEFAULT_DEF (operand)) + dump_gimple_expr (MSG_NOTE, TDF_SLIM, SSA_NAME_DEF_STMT (operand), 0); + else + dump_generic_expr (MSG_NOTE, TDF_SLIM, operand); } if (CONSTANT_CLASS_P (operand)) - { - *dt = vect_constant_def; - return true; - } - - if (is_gimple_min_invariant (operand)) - { - *dt = vect_external_def; - return true; - } - - if (TREE_CODE (operand) != SSA_NAME) - { - if (dump_enabled_p ()) - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "not ssa-name.\n"); - return false; - } - - if (SSA_NAME_IS_DEFAULT_DEF (operand)) - { - *dt = vect_external_def; - return true; - } - - gimple *def_stmt = SSA_NAME_DEF_STMT (operand); - if (dump_enabled_p ()) - { - dump_printf_loc (MSG_NOTE, vect_location, "def_stmt: "); - dump_gimple_stmt (MSG_NOTE, TDF_SLIM, def_stmt, 0); - } - - if (! vect_stmt_in_region_p (vinfo, def_stmt)) + *dt = vect_constant_def; + else if (is_gimple_min_invariant (operand)) + *dt = vect_external_def; + else if (TREE_CODE (operand) != SSA_NAME) + *dt = vect_unknown_def_type; + else if (SSA_NAME_IS_DEFAULT_DEF (operand)) *dt = vect_external_def; else { - stmt_vec_info stmt_vinfo = vinfo_for_stmt (def_stmt); - if (STMT_VINFO_IN_PATTERN_P (stmt_vinfo)) + gimple *def_stmt = SSA_NAME_DEF_STMT (operand); + if (! vect_stmt_in_region_p (vinfo, def_stmt)) + *dt = vect_external_def; + else { - def_stmt = STMT_VINFO_RELATED_STMT (stmt_vinfo); - stmt_vinfo = vinfo_for_stmt (def_stmt); + stmt_vec_info stmt_vinfo = vinfo_for_stmt (def_stmt); + if (STMT_VINFO_IN_PATTERN_P (stmt_vinfo)) + { + def_stmt = STMT_VINFO_RELATED_STMT (stmt_vinfo); + stmt_vinfo = vinfo_for_stmt (def_stmt); + } + switch (gimple_code (def_stmt)) + { + case GIMPLE_PHI: + case GIMPLE_ASSIGN: + case GIMPLE_CALL: + *dt = STMT_VINFO_DEF_TYPE (stmt_vinfo); + break; + default: + *dt = vect_unknown_def_type; + break; + } } - *dt = STMT_VINFO_DEF_TYPE (stmt_vinfo); + if (def_stmt_out) + *def_stmt_out = def_stmt; } - if (def_stmt_out) - *def_stmt_out = def_stmt; if (dump_enabled_p ()) { - dump_printf_loc (MSG_NOTE, vect_location, "type of def: "); + dump_printf (MSG_NOTE, ", type of def: "); switch (*dt) { case vect_uninitialized_def: @@ -10131,19 +10123,6 @@ vect_is_simple_use (tree operand, vec_info *vinfo, enum vect_def_type *dt, return false; } - switch (gimple_code (def_stmt)) - { - case GIMPLE_PHI: - case GIMPLE_ASSIGN: - case GIMPLE_CALL: - break; - default: - if (dump_enabled_p ()) - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "unsupported defining stmt:\n"); - return false; - } - return true; } @@ -10179,6 +10158,13 @@ vect_is_simple_use (tree operand, vec_info *vinfo, enum vect_def_type *dt, stmt_vec_info stmt_info = vinfo_for_stmt (def_stmt); *vectype = STMT_VINFO_VECTYPE (stmt_info); gcc_assert (*vectype != NULL_TREE); + if (dump_enabled_p ()) + { + dump_printf_loc (MSG_NOTE, vect_location, + "vect_is_simple_use: vectype "); + dump_generic_expr (MSG_NOTE, TDF_SLIM, *vectype); + dump_printf (MSG_NOTE, "\n"); + } } else if (*dt == vect_uninitialized_def || *dt == vect_constant_def