DSE used ao_ref_init_from_ptr_and_size for .MASK_STORE but alias-analysis will use the specified size to disambiguate against smaller objects. For .MASK_STORE we instead have to make the access size unspecified but we can still constrain the access extent based on the maximum size possible.
Bootstrapped and tested on x86_64-unknown-linux-gnu. No testcase, I'd appreciate a runtime one. PR tree-optimization/120817 * tree-ssa-dse.cc (initialize_ao_ref_for_dse): Use ao_ref_init_from_ptr_and_range with unknown size for .MASK_STORE and .MASK_LEN_STORE. --- gcc/tree-ssa-dse.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/tree-ssa-dse.cc b/gcc/tree-ssa-dse.cc index 5ac4280ee36..51a572316cd 100644 --- a/gcc/tree-ssa-dse.cc +++ b/gcc/tree-ssa-dse.cc @@ -181,10 +181,10 @@ initialize_ao_ref_for_dse (gimple *stmt, ao_ref *write, bool may_def_ok = false) can provide a may-def variant. */ if (may_def_ok) { - ao_ref_init_from_ptr_and_size ( - write, gimple_call_arg (stmt, 0), - TYPE_SIZE_UNIT ( - TREE_TYPE (gimple_call_arg (stmt, stored_value_index)))); + ao_ref_init_from_ptr_and_range ( + write, gimple_call_arg (stmt, 0), true, 0, -1, + tree_to_poly_int64 (TYPE_SIZE ( + TREE_TYPE (gimple_call_arg (stmt, stored_value_index))))); return true; } break; -- 2.43.0