https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105030
--- Comment #14 from rguenther at suse dot de <rguenther at suse dot de> --- On Fri, 8 Apr 2022, guihaoc at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105030 > > --- Comment #13 from HaoChen Gui <guihaoc at gcc dot gnu.org> --- > Could we use the original alias set if the tree code of 'atemp' is var_decl? > Is > it safe? In which situation we shall use alias-set zero? Thanks. No, just being a VAR_DECL is not good enough. Basically you have to somehow have knowledge about the dynamic type of the object we store to before the store and see whether the conditional store might change that. If so the store needs to use a type that allows accesses to both the original and the possibly changed dynamic type from existing accesses following the now unconditional store. When the access is to a VAR_DECL we can look for the case where the access is to the full variable (partial stores are always difficult to judge wrt dynamic type changes) and whether there is a dominating load (also to the full variable) that either uses the same type or allows us to find a common type to use.