diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-04-19 21:16:18 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-04-19 21:16:18 +0200 |
commit | 18108d94e9aff71811a7923fe67db7626378f565 (patch) | |
tree | ddd35d8dcd17acb5ddfc2bf7b8105dbe62222911 /gcc/fold-const.c | |
parent | f62a0ddd737a3faa3925ae211bd22fa8ca62c112 (diff) | |
download | gcc-18108d94e9aff71811a7923fe67db7626378f565.tar.gz |
re PR tree-optimization/85467 (ICE: verify_gimple failed: non-trivial conversion at assignment with -O2 -fno-tree-ccp --param=sccvn-max-scc-size=10)
PR tree-optimization/85467
* fold-const.c (fold_ternary_loc) <case BIT_FIELD_REF>: Use
VECTOR_TYPE_P macro. If type is vector type, VIEW_CONVERT_EXPR the
VECTOR_CST element to type.
* gcc.dg/pr85467.c: New test.
From-SVN: r259507
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 3a99b66cf45..6472f103094 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -11631,7 +11631,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, case BIT_FIELD_REF: if (TREE_CODE (arg0) == VECTOR_CST && (type == TREE_TYPE (TREE_TYPE (arg0)) - || (TREE_CODE (type) == VECTOR_TYPE + || (VECTOR_TYPE_P (type) && TREE_TYPE (type) == TREE_TYPE (TREE_TYPE (arg0)))) && tree_fits_uhwi_p (op1) && tree_fits_uhwi_p (op2)) @@ -11653,7 +11653,12 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, if (TREE_CODE (arg0) == VECTOR_CST) { if (n == 1) - return VECTOR_CST_ELT (arg0, idx); + { + tem = VECTOR_CST_ELT (arg0, idx); + if (VECTOR_TYPE_P (type)) + tem = fold_build1 (VIEW_CONVERT_EXPR, type, tem); + return tem; + } tree_vector_builder vals (type, n, 1); for (unsigned i = 0; i < n; ++i) |