From: Yang Yang Date: Tue, 14 Apr 2020 19:42:23 +0000 (+0000) Subject: PR tree-optimization/94574 - aarch64: ICE during GIMPLE pass:ccp X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f65cecabc32fe12b024253502af953e657e1a878;p=gcc.git PR tree-optimization/94574 - aarch64: ICE during GIMPLE pass:ccp In this PR the testcase ICEs because a BIT_INSERT_EXPR whose replaced bits are not fully inside the container is generated. A size check is added to avoid this kind of ICE. gcc/ChangeLog: PR tree-optimization/94574 * tree-ssa.c (non_rewritable_lvalue_p): Add size check when analyzing whether a vector-insert is rewritable using a BIT_INSERT_EXPR. gcc/testsuite/ChangeLog: PR tree-optimization/94574 * gcc.dg/pr94574.c: New test. --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 343b52c0512..441dcab490d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-04-14 Yang Yang + + PR tree-optimization/94574 + * tree-ssa.c (non_rewritable_lvalue_p): Add size check when analyzing + whether a vector-insert is rewritable using a BIT_INSERT_EXPR. + 2020-04-14 H.J. Lu PR target/94561 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e7a82389fc6..051dcb15f48 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-04-14 Yang Yang + + PR tree-optimization/94574 + * gcc.dg/pr94574.c: New test. + 2020-04-14 H.J. Lu PR target/94561 diff --git a/gcc/testsuite/gcc.dg/pr94574.c b/gcc/testsuite/gcc.dg/pr94574.c new file mode 100644 index 00000000000..0d18bd82832 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr94574.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -w -Wno-psabi" } */ + +typedef unsigned int v4si __attribute__((vector_size(16))); +typedef unsigned int v2si __attribute__((vector_size(8))); + +/* The aliasing is somewhat dubious here, but it must compile. */ + +v2si +foo (v4si v) +{ + v2si res; + *(v4si *) &res = v; + return res; +} diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 344f32d69cf..4f4ab2b8992 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1543,7 +1543,9 @@ non_rewritable_lvalue_p (tree lhs) && known_gt (wi::to_poly_offset (TYPE_SIZE_UNIT (TREE_TYPE (decl))), mem_ref_offset (lhs)) && multiple_of_p (sizetype, TREE_OPERAND (lhs, 1), - TYPE_SIZE_UNIT (TREE_TYPE (lhs)))) + TYPE_SIZE_UNIT (TREE_TYPE (lhs))) + && known_ge (wi::to_poly_offset (TYPE_SIZE (TREE_TYPE (decl))), + wi::to_poly_offset (TYPE_SIZE (TREE_TYPE (lhs))))) { poly_uint64 lhs_bits, nelts; if (poly_int_tree_p (TYPE_SIZE (TREE_TYPE (lhs)), &lhs_bits)