diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-10-06 11:39:07 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-10-06 11:39:07 +0200 |
commit | 2f3914287d4c1c75394d4f101ad5bd4d9d4b66e8 (patch) | |
tree | 305f8eac06e4d9b00a2a7347b8b47303405eb9b2 /gcc/gimple-ssa-store-merging.c | |
parent | d20eac1b41b9a86128a80f374e029d9638d14cba (diff) | |
download | gcc-2f3914287d4c1c75394d4f101ad5bd4d9d4b66e8.zip gcc-2f3914287d4c1c75394d4f101ad5bd4d9d4b66e8.tar.gz gcc-2f3914287d4c1c75394d4f101ad5bd4d9d4b66e8.tar.bz2 |
re PR tree-optimization/82434 (-fstore-merging does not work reliably.)
PR tree-optimization/82434
* fold-const.h (can_native_encode_type_p,
can_native_encode_string_p): Remove.
* fold-const.c (native_encode_int): Formatting fixes. If ptr is NULL,
don't encode anything, just return what would be otherwise returned.
(native_encode_fixed, native_encode_complex, native_encode_vector):
Likewise.
(native_encode_string): Likewise. Inline by hand
can_native_encode_string_p.
(can_native_encode_type_p): Remove.
(can_native_encode_string_p): Remove.
* tree-vect-stmts.c (vectorizable_store): Instead of testing just
STRING_CSTs using can_native_encode_string_p, test all
CONSTANT_CLASS_P values using native_encode_expr with NULL ptr.
* gimple-ssa-store-merging.c (encode_tree_to_bitpos): Remove last
argument from native_encode_expr.
(rhs_valid_for_store_merging_p): Use native_encode_expr with NULL ptr.
(pass_store_merging::execute): Don't unnecessarily look for 3 stmts,
but just 2.
* gcc.dg/store_merging_9.c: New test.
From-SVN: r253483
Diffstat (limited to 'gcc/gimple-ssa-store-merging.c')
-rw-r--r-- | gcc/gimple-ssa-store-merging.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c index cb76403..bc50bab 100644 --- a/gcc/gimple-ssa-store-merging.c +++ b/gcc/gimple-ssa-store-merging.c @@ -357,8 +357,7 @@ encode_tree_to_bitpos (tree expr, unsigned char *ptr, int bitlen, int bitpos, || !int_mode_for_size (bitlen, 0).exists ()); if (!sub_byte_op_p) - return (native_encode_expr (tmp_int, ptr + first_byte, total_bytes, 0) - != 0); + return native_encode_expr (tmp_int, ptr + first_byte, total_bytes) != 0; /* LITTLE-ENDIAN We are writing a non byte-sized quantity or at a position that is not @@ -408,7 +407,7 @@ encode_tree_to_bitpos (tree expr, unsigned char *ptr, int bitlen, int bitpos, memset (tmpbuf, '\0', byte_size); /* The store detection code should only have allowed constants that are accepted by native_encode_expr. */ - if (native_encode_expr (expr, tmpbuf, byte_size - 1, 0) == 0) + if (native_encode_expr (expr, tmpbuf, byte_size - 1) == 0) gcc_unreachable (); /* The native_encode_expr machinery uses TYPE_MODE to determine how many @@ -1326,12 +1325,8 @@ lhs_valid_for_store_merging_p (tree lhs) static bool rhs_valid_for_store_merging_p (tree rhs) { - tree type = TREE_TYPE (rhs); - if (TREE_CODE_CLASS (TREE_CODE (rhs)) != tcc_constant - || !can_native_encode_type_p (type)) - return false; - - return true; + return native_encode_expr (rhs, NULL, + GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (rhs)))) != 0; } /* Entry point for the pass. Go over each basic block recording chains of @@ -1357,7 +1352,7 @@ pass_store_merging::execute (function *fun) if (is_gimple_debug (gsi_stmt (gsi))) continue; - if (++num_statements > 2) + if (++num_statements >= 2) break; } |