https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82604
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- Sth like the following which only works up to the point of dependence analysis trying to disambiguate this ref against others ... I suppose some dr_may_alias_p tweaks to consider niter information and step/size to do a "simple" offset based overlap test is missing. Index: gcc/tree-data-ref.c =================================================================== --- gcc/tree-data-ref.c (revision 254858) +++ gcc/tree-data-ref.c (working copy) @@ -4827,7 +4827,7 @@ get_references_in_stmt (gimple *stmt, ve clobbers_memory = true; break; } - else + else if (! gimple_call_builtin_p (stmt, BUILT_IN_MEMSET)) clobbers_memory = true; } else if (stmt_code == GIMPLE_ASM @@ -4888,6 +4888,12 @@ get_references_in_stmt (gimple *stmt, ve default: break; } + else if (gimple_call_builtin_p (stmt, BUILT_IN_MEMSET)) + { + ref.ref = fold_build2 (MEM_REF, build_array_type (char_type_node, build_index_type (gimple_call_arg (stmt, 2))), gimple_call_arg (stmt, 0), build_zero_cst (ptr_type_node)); + references->safe_push (ref); + return false; + } op0 = gimple_call_lhs (stmt); n = gimple_call_num_args (stmt);