diff options
author | Richard Guenther <rguenther@suse.de> | 2011-10-06 10:34:18 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-10-06 10:34:18 +0000 |
commit | 69c2fbf1ec048f4b6e98d87c9eac15a2f3517fae (patch) | |
tree | 0c61e2ca7b43856f679a73d727e8eb626f35d3ff /gcc | |
parent | 50000e860242d036402fce25ea56ddc4e6d209cf (diff) | |
download | gcc-69c2fbf1ec048f4b6e98d87c9eac15a2f3517fae.zip gcc-69c2fbf1ec048f4b6e98d87c9eac15a2f3517fae.tar.gz gcc-69c2fbf1ec048f4b6e98d87c9eac15a2f3517fae.tar.bz2 |
fold-const.c (fold_ternary_loc): Also fold non-constant vector CONSTRUCTORs.
2011-10-06 Richard Guenther <rguenther@suse.de>
* fold-const.c (fold_ternary_loc): Also fold non-constant
vector CONSTRUCTORs. Make more efficient.
* tree-ssa-dom.c (cprop_operand): Don't handle virtual operands.
(cprop_into_stmt): Don't propagate into virtual operands.
(optimize_stmt): Really dump original statement.
From-SVN: r179597
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fold-const.c | 25 |
2 files changed, 17 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index be15692..ce0215d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2011-10-06 Richard Guenther <rguenther@suse.de> + + * fold-const.c (fold_ternary_loc): Also fold non-constant + vector CONSTRUCTORs. Make more efficient. + * tree-ssa-dom.c (cprop_operand): Don't handle virtual operands. + (cprop_into_stmt): Don't propagate into virtual operands. + (optimize_stmt): Really dump original statement. + 2011-10-06 Nick Clifton <nickc@redhat.com> * config/rx/rx.md (smin3): Revert previous delta. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index c3871f1..404d904 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -13647,7 +13647,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, case BIT_FIELD_REF: if ((TREE_CODE (arg0) == VECTOR_CST - || (TREE_CODE (arg0) == CONSTRUCTOR && TREE_CONSTANT (arg0))) + || TREE_CODE (arg0) == CONSTRUCTOR) && type == TREE_TYPE (TREE_TYPE (arg0))) { unsigned HOST_WIDE_INT width = tree_low_cst (arg1, 1); @@ -13659,24 +13659,17 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, && (idx = idx / width) < TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg0))) { - tree elements = NULL_TREE; - if (TREE_CODE (arg0) == VECTOR_CST) - elements = TREE_VECTOR_CST_ELTS (arg0); - else { - unsigned HOST_WIDE_INT idx; - tree value; - - FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (arg0), idx, value) - elements = tree_cons (NULL_TREE, value, elements); + tree elements = TREE_VECTOR_CST_ELTS (arg0); + while (idx-- > 0 && elements) + elements = TREE_CHAIN (elements); + if (elements) + return TREE_VALUE (elements); } - while (idx-- > 0 && elements) - elements = TREE_CHAIN (elements); - if (elements) - return TREE_VALUE (elements); - else - return build_zero_cst (type); + else if (idx < CONSTRUCTOR_NELTS (arg0)) + return CONSTRUCTOR_ELT (arg0, idx)->value; + return build_zero_cst (type); } } |