Message ID | 87o9mahrhi.fsf@linaro.org |
---|---|
State | New |
Headers | show |
Series | Allow VEC_PERM_EXPR folding to fail | expand |
On 01/04/2018 03:02 AM, Richard Sandiford wrote: > tree-ssa-forwprop.c was asserting that a VEC_PERM_EXPR fold on three > VECTOR_CSTs would always succeed, but it's possible for it to fail > with variable-length vectors. > > Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu. > Also tested by comparing the before and after assembly output for at > least one target per CPU directory. OK to install? > > Richard > > > 2018-01-04 Richard Sandiford <richard.sandiford@linaro.org> > > gcc/ > * tree-ssa-forwprop.c (is_combined_permutation_identity): Allow > the VEC_PERM_EXPR fold to fail. OK. Ideally we'd have a test which failed here. jeff
On Thu, Jan 4, 2018 at 6:46 PM, Jeff Law <law@redhat.com> wrote: > On 01/04/2018 03:02 AM, Richard Sandiford wrote: >> tree-ssa-forwprop.c was asserting that a VEC_PERM_EXPR fold on three >> VECTOR_CSTs would always succeed, but it's possible for it to fail >> with variable-length vectors. >> >> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu. >> Also tested by comparing the before and after assembly output for at >> least one target per CPU directory. OK to install? >> >> Richard >> >> >> 2018-01-04 Richard Sandiford <richard.sandiford@linaro.org> >> >> gcc/ >> * tree-ssa-forwprop.c (is_combined_permutation_identity): Allow >> the VEC_PERM_EXPR fold to fail. > OK. Ideally we'd have a test which failed here. Yeah, can't make up an example myself that would fail. Richard. > > jeff
Index: gcc/tree-ssa-forwprop.c =================================================================== --- gcc/tree-ssa-forwprop.c 2018-01-03 21:42:44.571646705 +0000 +++ gcc/tree-ssa-forwprop.c 2018-01-04 10:00:03.582673530 +0000 @@ -1865,7 +1865,8 @@ is_combined_permutation_identity (tree m gcc_checking_assert (TREE_CODE (mask1) == VECTOR_CST && TREE_CODE (mask2) == VECTOR_CST); mask = fold_ternary (VEC_PERM_EXPR, TREE_TYPE (mask1), mask1, mask1, mask2); - gcc_assert (TREE_CODE (mask) == VECTOR_CST); + if (mask == NULL_TREE || TREE_CODE (mask) != VECTOR_CST) + return 0; if (!VECTOR_CST_NELTS (mask).is_constant (&nelts)) return 0;