https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78821
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Wed Nov 8 15:46:58 2017 New Revision: 254536 URL: https://gcc.gnu.org/viewcvs?rev=254536&root=gcc&view=rev Log: PR tree-optimization/78821 * gimple-ssa-store-merging.c (struct store_operand_info): Add bit_not_p data member. (store_operand_info::store_operand_info): Initialize it to false. (pass_store_merging::terminate_all_aliasing_chains): Rewritten to use ref_maybe_used_by_stmt_p and stmt_may_clobber_ref_p on lhs of each store in the group, and if chain_info is non-NULL, to ignore altogether that chain. (compatible_load_p): Fail if bit_not_p does not match. (imm_store_chain_info::output_merged_store): Handle bit_not_p loads. (handled_load): Fill in bit_not_p. Handle BIT_NOT_EXPR. (pass_store_merging::process_store): Adjust terminate_all_aliasing_chains calls to pass NULL in all current spots, call terminate_all_aliasing_chains newly when adding a store into a chain with non-NULL chain_info. * gcc.dg/store_merging_2.c: Expect 3 store mergings instead of 2. * gcc.dg/store_merging_13.c (f7, f8, f9, f10, f11, f12, f13): New functions. (main): Test also those. Expect 13 store mergings instead of 6. * gcc.dg/store_merging_14.c (f7, f8, f9): New functions. (main): Test also those. Expect 9 store mergings instead of 6. Modified: trunk/gcc/ChangeLog trunk/gcc/gimple-ssa-store-merging.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/store_merging_13.c trunk/gcc/testsuite/gcc.dg/store_merging_14.c trunk/gcc/testsuite/gcc.dg/store_merging_2.c