diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2020-04-21 16:11:07 +0100 |
---|---|---|
committer | Richard Sandiford <richard.sandiford@arm.com> | 2020-04-21 16:11:07 +0100 |
commit | 85353e24ca90282e1d3620682841f524de20475c (patch) | |
tree | 46688d72def322254f2c555f54ce7e7266956221 /gcc/tree-ssa-forwprop.c | |
parent | 619602346aed9dae3f338d9f18767414446adf78 (diff) | |
download | gcc-85353e24ca90282e1d3620682841f524de20475c.zip gcc-85353e24ca90282e1d3620682841f524de20475c.tar.gz gcc-85353e24ca90282e1d3620682841f524de20475c.tar.bz2 |
forwprop: Fix ICE when building a VEC_PERM_EXPR [PR94683]
The type compatibility handling in simplify_vector_constructor is
based on the number of elements and on element type compatibility,
but that's no longer enough to ensure that two vector types are
compatible. This patch uses a VIEW_CONVERT_EXPR if the permutation
type and result type are distinct.
2020-04-21 Richard Sandiford <richard.sandiford@arm.com>
gcc/
PR tree-optimization/94683
* tree-ssa-forwprop.c (simplify_vector_constructor): Use a
VIEW_CONVERT_EXPR to handle mixtures of similarly-structured
but distinct vector types.
gcc/testsuite/
PR tree-optimization/94683
* gcc.target/aarch64/sve/acle/general/pr94683.c: New test.
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 3d8acf7..1a50045 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -2598,6 +2598,11 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi) res, TYPE_SIZE (type), bitsize_zero_node); if (conv_code != ERROR_MARK) res = gimple_build (&stmts, conv_code, type, res); + else if (!useless_type_conversion_p (type, TREE_TYPE (res))) + { + gcc_assert (!targetm.compatible_vector_types_p (type, perm_type)); + res = gimple_build (&stmts, VIEW_CONVERT_EXPR, type, res); + } /* Blend in the actual constant. */ if (converted_orig1) res = gimple_build (&stmts, VEC_PERM_EXPR, type, |