aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/parser.cc2
-rw-r--r--gcc/testsuite/g++.dg/template/dependent-base6.C4
-rw-r--r--gcc/tree-vect-slp.cc100
-rw-r--r--gcc/tree-vectorizer.h9
4 files changed, 55 insertions, 60 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 1ed2f37..9280632 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -19091,7 +19091,7 @@ cp_parser_mem_initializer_id (cp_parser* parser)
return cp_parser_class_name (parser,
/*typename_keyword_p=*/true,
/*template_keyword_p=*/template_p,
- typename_type,
+ class_type,
/*check_dependency_p=*/true,
/*class_head_p=*/false,
/*is_declaration=*/true);
diff --git a/gcc/testsuite/g++.dg/template/dependent-base6.C b/gcc/testsuite/g++.dg/template/dependent-base6.C
index b4bc5c2..9f2a7a2 100644
--- a/gcc/testsuite/g++.dg/template/dependent-base6.C
+++ b/gcc/testsuite/g++.dg/template/dependent-base6.C
@@ -8,5 +8,7 @@ struct A {
struct S1 : A::B { }; // OK
-template<class T> struct S2 : T::B { }; // OK, used to fail
+template<class T> struct S2 : T::B { // OK, used to fail
+ S2() : T::B() { } // Also OK
+};
template struct S2<A>;
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index fe3bcff..13a2995 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -53,6 +53,9 @@ along with GCC; see the file COPYING3. If not see
#include "sreal.h"
#include "predict.h"
+#define REDUC_GROUP_FIRST_ELEMENT(S) \
+ (gcc_checking_assert (!(S)->dr_aux.dr), (S)->first_element)
+
static bool vect_transform_slp_perm_load_1 (vec_info *, slp_tree,
load_permutation_t &,
const vec<tree> &,
@@ -4189,14 +4192,50 @@ vect_build_slp_instance (vec_info *vinfo,
static bool
vect_analyze_slp_reduc_chain (loop_vec_info vinfo,
scalar_stmts_to_slp_tree_map_t *bst_map,
- vec<stmt_vec_info> &scalar_stmts,
- stmt_vec_info reduc_phi_info,
+ stmt_vec_info scalar_stmt,
unsigned max_tree_size, unsigned *limit)
{
- /* If there's no budget left bail out early. */
- if (*limit == 0)
+ vec<stmt_vec_info> scalar_stmts = vNULL;
+
+ bool fail = false;
+ /* ??? We could leave operation code checking to SLP discovery. */
+ code_helper code = STMT_VINFO_REDUC_CODE (STMT_VINFO_REDUC_DEF
+ (vect_orig_stmt (scalar_stmt)));
+ bool first = true;
+ stmt_vec_info next_stmt = scalar_stmt;
+ do
+ {
+ stmt_vec_info stmt = next_stmt;
+ gimple_match_op op;
+ if (!gimple_extract_op (STMT_VINFO_STMT (stmt), &op))
+ gcc_unreachable ();
+ tree reduc_def = gimple_arg (STMT_VINFO_STMT (stmt),
+ STMT_VINFO_REDUC_IDX (stmt));
+ next_stmt = vect_stmt_to_vectorize (vinfo->lookup_def (reduc_def));
+ gcc_assert (is_a <gphi *> (STMT_VINFO_STMT (next_stmt))
+ || STMT_VINFO_REDUC_IDX (next_stmt) != -1);
+ if (!gimple_extract_op (STMT_VINFO_STMT (vect_orig_stmt (stmt)), &op))
+ gcc_unreachable ();
+ if (CONVERT_EXPR_CODE_P (op.code)
+ && (first
+ || is_a <gphi *> (STMT_VINFO_STMT (next_stmt))))
+ ;
+ else if (code != op.code)
+ {
+ fail = true;
+ break;
+ }
+ else
+ scalar_stmts.safe_push (stmt);
+ first = false;
+ }
+ while (!is_a <gphi *> (STMT_VINFO_STMT (next_stmt)));
+ if (fail || scalar_stmts.length () <= 1)
return false;
+ scalar_stmts.reverse ();
+ stmt_vec_info reduc_phi_info = next_stmt;
+
/* Build the tree for the SLP instance. */
vec<stmt_vec_info> root_stmt_infos = vNULL;
vec<tree> remain = vNULL;
@@ -4315,7 +4354,9 @@ vect_analyze_slp_reduc_chain (loop_vec_info vinfo,
return true;
}
+
/* Failed to SLP. */
+ scalar_stmts.release ();
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"SLP discovery of reduction chain failed\n");
@@ -4338,55 +4379,14 @@ vect_analyze_slp_reduction (loop_vec_info vinfo,
if (*limit == 0)
return false;
- vec<stmt_vec_info> scalar_stmts = vNULL;
/* Try to gather a reduction chain. */
if (! force_single_lane
- && STMT_VINFO_DEF_TYPE (scalar_stmt) == vect_reduction_def)
- {
- bool fail = false;
- /* ??? We could leave operation code checking to SLP discovery. */
- code_helper code
- = STMT_VINFO_REDUC_CODE (STMT_VINFO_REDUC_DEF
- (vect_orig_stmt (scalar_stmt)));
- bool first = true;
- stmt_vec_info next_stmt = scalar_stmt;
- do
- {
- stmt_vec_info stmt = next_stmt;
- gimple_match_op op;
- if (!gimple_extract_op (STMT_VINFO_STMT (stmt), &op))
- gcc_unreachable ();
- tree reduc_def = gimple_arg (STMT_VINFO_STMT (stmt),
- STMT_VINFO_REDUC_IDX (stmt));
- next_stmt = vect_stmt_to_vectorize (vinfo->lookup_def (reduc_def));
- gcc_assert (is_a <gphi *> (STMT_VINFO_STMT (next_stmt))
- || STMT_VINFO_REDUC_IDX (next_stmt) != -1);
- if (!gimple_extract_op (STMT_VINFO_STMT (vect_orig_stmt (stmt)), &op))
- gcc_unreachable ();
- if (CONVERT_EXPR_CODE_P (op.code)
- && (first
- || is_a <gphi *> (STMT_VINFO_STMT (next_stmt))))
- ;
- else if (code != op.code)
- {
- fail = true;
- break;
- }
- else
- scalar_stmts.safe_push (stmt);
- first = false;
- }
- while (!is_a <gphi *> (STMT_VINFO_STMT (next_stmt)));
- if (!fail && scalar_stmts.length () > 1)
- {
- scalar_stmts.reverse ();
- if (vect_analyze_slp_reduc_chain (vinfo, bst_map, scalar_stmts,
- next_stmt, max_tree_size, limit))
- return true;
- scalar_stmts.release ();
- }
- }
+ && STMT_VINFO_DEF_TYPE (scalar_stmt) == vect_reduction_def
+ && vect_analyze_slp_reduc_chain (vinfo, bst_map, scalar_stmt,
+ max_tree_size, limit))
+ return true;
+ vec<stmt_vec_info> scalar_stmts;
scalar_stmts.create (1);
scalar_stmts.quick_push (scalar_stmt);
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index a6c313e..4785cbd 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -1538,7 +1538,7 @@ public:
/* Whether the stmt is SLPed, loop-based vectorized, or both. */
enum slp_vect_type slp_type;
- /* Interleaving and reduction chains info. */
+ /* Interleaving chains info. */
/* First element in the group. */
stmt_vec_info first_element;
/* Pointer to the next element in the group. */
@@ -1711,13 +1711,6 @@ struct gather_scatter_info {
#define DR_GROUP_GAP(S) \
(gcc_checking_assert ((S)->dr_aux.dr), (S)->gap)
-#define REDUC_GROUP_FIRST_ELEMENT(S) \
- (gcc_checking_assert (!(S)->dr_aux.dr), (S)->first_element)
-#define REDUC_GROUP_NEXT_ELEMENT(S) \
- (gcc_checking_assert (!(S)->dr_aux.dr), (S)->next_element)
-#define REDUC_GROUP_SIZE(S) \
- (gcc_checking_assert (!(S)->dr_aux.dr), (S)->size)
-
#define STMT_VINFO_RELEVANT_P(S) ((S)->relevant != vect_unused_in_scope)
#define PURE_SLP_STMT(S) ((S)->slp_type == pure_slp)