diff options
author | Jakub Jelinek <jakub@redhat.com> | 2012-11-13 08:25:36 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2012-11-13 08:25:36 +0100 |
commit | 784fb9b322452e7f5e31e75be538ccf453335abb (patch) | |
tree | 5384a6491928ac5d95d62e04069c2d911f262a7c /gcc/fold-const.c | |
parent | 5d68b7e60b0b2f26624477ff0b7ef9f2595c9325 (diff) | |
download | gcc-784fb9b322452e7f5e31e75be538ccf453335abb.zip gcc-784fb9b322452e7f5e31e75be538ccf453335abb.tar.gz gcc-784fb9b322452e7f5e31e75be538ccf453335abb.tar.bz2 |
re PR tree-optimization/55281 (ICE in build_int_cst_wide, at tree.c:1217 (with Ofast, ok with O3))
PR tree-optimization/55281
* tree-vect-generic.c (expand_vector_condition): Accept any
is_gimple_val rather than just SSA_NAME if not COMPARISON_CLASS_P.
* fold-const.c (fold_ternary_loc): Fold VEC_COND_EXPR if arg0 is
either integer_all_onesp or integer_zerop.
* tree-vect-stmts.c (vectorizable_condition): Build the condition
using corresponding vector integer type instead of vectype.
* gcc.dg/vect/fast-math-pr55281.c: New test.
* g++.dg/opt/pr55281.C: New test.
From-SVN: r193471
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 4fa1fd6..2e90864 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -14036,6 +14036,16 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, return NULL_TREE; + case VEC_COND_EXPR: + if (TREE_CODE (arg0) == VECTOR_CST) + { + if (integer_all_onesp (arg0) && !TREE_SIDE_EFFECTS (op2)) + return pedantic_non_lvalue_loc (loc, op1); + if (integer_zerop (arg0) && !TREE_SIDE_EFFECTS (op1)) + return pedantic_non_lvalue_loc (loc, op2); + } + return NULL_TREE; + case CALL_EXPR: /* CALL_EXPRs used to be ternary exprs. Catch any mistaken uses of fold_ternary on them. */ |