diff options
author | Richard Guenther <rguenther@suse.de> | 2012-05-29 14:40:16 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-05-29 14:40:16 +0000 |
commit | 508ef0c675b409e2c92c8078a2dc5043da88db1b (patch) | |
tree | defff990b81b71950b63227548cb841b34adf3bd /gcc/tree-data-ref.c | |
parent | 073a899888791eb53e4454236e3463b6619bfd9b (diff) | |
download | gcc-508ef0c675b409e2c92c8078a2dc5043da88db1b.zip gcc-508ef0c675b409e2c92c8078a2dc5043da88db1b.tar.gz gcc-508ef0c675b409e2c92c8078a2dc5043da88db1b.tar.bz2 |
re PR tree-optimization/53516 (Vectorization and memset recognition miscompile bitfield stores)
2012-05-29 Richard Guenther <rguenther@suse.de>
PR tree-optimization/53516
* tree-data-ref.c (stmt_with_adjacent_zero_store_dr_p): Reject
bitfield accesses.
* tree-vect-data-refs.c (vect_analyze_data_refs): Likewise.
* gcc.dg/torture/pr53516.c: New testcase.
From-SVN: r187961
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r-- | gcc/tree-data-ref.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 90b6f70..8a23efa 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -5255,26 +5255,33 @@ stores_from_loop (struct loop *loop, VEC (gimple, heap) **stmts) bool stmt_with_adjacent_zero_store_dr_p (gimple stmt) { - tree op0, op1; + tree lhs, rhs; bool res; struct data_reference *dr; if (!stmt || !gimple_vdef (stmt) - || !is_gimple_assign (stmt) - || !gimple_assign_single_p (stmt) - || !(op1 = gimple_assign_rhs1 (stmt)) - || !(integer_zerop (op1) || real_zerop (op1))) + || !gimple_assign_single_p (stmt)) + return false; + + lhs = gimple_assign_lhs (stmt); + rhs = gimple_assign_rhs1 (stmt); + + /* If this is a bitfield store bail out. */ + if (TREE_CODE (lhs) == COMPONENT_REF + && DECL_BIT_FIELD (TREE_OPERAND (lhs, 1))) + return false; + + if (!(integer_zerop (rhs) || real_zerop (rhs))) return false; dr = XCNEW (struct data_reference); - op0 = gimple_assign_lhs (stmt); DR_STMT (dr) = stmt; - DR_REF (dr) = op0; + DR_REF (dr) = lhs; res = dr_analyze_innermost (dr, loop_containing_stmt (stmt)) - && stride_of_unit_type_p (DR_STEP (dr), TREE_TYPE (op0)); + && stride_of_unit_type_p (DR_STEP (dr), TREE_TYPE (lhs)); free_data_ref (dr); return res; |