Commit 934f135b by Richard Sandiford Committed by Richard Sandiford

Add missing VECTOR_MODE_P checks (PR 92595)

This patch fixes some cases in which we weren't checking whether we had
a vector mode before calling related_vector_mode or before making vector
optab queries.

2019-11-21  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	PR tree-optimization/92595
	* tree-vect-stmts.c (get_group_load_store_type): Add a VECTOR_MODE_P
	check.
	(vectorizable_store, vectorizable_load): Likewise.

gcc/testsuite/
	PR tree-optimization/92595
	* g++.dg/vect/pr92595.cc: New test.

From-SVN: r278590
parent 82399335
2019-11-21 Richard Sandiford <richard.sandiford@arm.com>
PR tree-optimization/92595
* tree-vect-stmts.c (get_group_load_store_type): Add a VECTOR_MODE_P
check.
(vectorizable_store, vectorizable_load): Likewise.
2019-11-21 Jan Hubicka <jh@suse.cz>
* ipa-inline.c (update_callee_keys): Add parameter UPDATE_SINCE.
2019-11-21 Richard Sandiford <richard.sandiford@arm.com>
PR tree-optimization/92595
* g++.dg/vect/pr92595.cc: New test.
2019-11-21 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
* gcc.target/arm/acle/crc_hf_1.c: Modify the compiler options directive
......
// { dg-do compile }
// { dg-require-effective-target c++11 }
// { dg-additional-options "-O3" }
// { dg-additional-options "-O3 -m32 -mno-sse" { target { i?86-*-* x86_64-*-* } } }
void *operator new(__SIZE_TYPE__, void *a) { return a; }
class b {
public:
using c = int *;
c e();
c h();
};
template <typename d> class j : b {
public:
void l() {
for (auto f = h(), g = e(); f != g; ++f)
new (f) d();
}
};
class m {
public:
enum i {};
struct C {
i : 8;
i k : 8;
};
};
class o {
j<m::C> n;
o();
};
o::o() { n.l(); }
......@@ -2308,6 +2308,7 @@ get_group_load_store_type (stmt_vec_info stmt_info, tree vectype, bool slp,
|| alignment_support_scheme == dr_unaligned_supported)
&& known_eq (nunits, (group_size - gap) * 2)
&& known_eq (nunits, group_size)
&& VECTOR_MODE_P (TYPE_MODE (vectype))
&& related_vector_mode (TYPE_MODE (vectype), elmode,
group_size - gap).exists (&vmode)
&& (convert_optab_handler (vec_init_optab,
......@@ -7822,8 +7823,9 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
of vector elts directly. */
scalar_mode elmode = SCALAR_TYPE_MODE (elem_type);
machine_mode vmode;
if (!related_vector_mode (TYPE_MODE (vectype), elmode,
group_size).exists (&vmode)
if (!VECTOR_MODE_P (TYPE_MODE (vectype))
|| !related_vector_mode (TYPE_MODE (vectype), elmode,
group_size).exists (&vmode)
|| (convert_optab_handler (vec_extract_optab,
TYPE_MODE (vectype), vmode)
== CODE_FOR_nothing))
......@@ -7840,6 +7842,7 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
element extracts from the original vector type and
element size stores. */
if (int_mode_for_size (lsize, 0).exists (&elmode)
&& VECTOR_MODE_P (TYPE_MODE (vectype))
&& related_vector_mode (TYPE_MODE (vectype), elmode,
lnunits).exists (&vmode)
&& (convert_optab_handler (vec_extract_optab,
......@@ -8922,8 +8925,9 @@ vectorizable_load (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
vector elts directly. */
scalar_mode elmode = SCALAR_TYPE_MODE (TREE_TYPE (vectype));
machine_mode vmode;
if (related_vector_mode (TYPE_MODE (vectype), elmode,
group_size).exists (&vmode)
if (VECTOR_MODE_P (TYPE_MODE (vectype))
&& related_vector_mode (TYPE_MODE (vectype), elmode,
group_size).exists (&vmode)
&& (convert_optab_handler (vec_init_optab,
TYPE_MODE (vectype), vmode)
!= CODE_FOR_nothing))
......@@ -8947,6 +8951,7 @@ vectorizable_load (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
/* If we can't construct such a vector fall back to
element loads of the original vector type. */
if (int_mode_for_size (lsize, 0).exists (&elmode)
&& VECTOR_MODE_P (TYPE_MODE (vectype))
&& related_vector_mode (TYPE_MODE (vectype), elmode,
lnunits).exists (&vmode)
&& (convert_optab_handler (vec_init_optab, vmode, elmode)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment