https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89430
--- Comment #15 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Hao Liu <h...@gcc.gnu.org>: https://gcc.gnu.org/g:54ecfb182bc32140722022c1d9818dee4bdc0e45 commit r11-897-g54ecfb182bc32140722022c1d9818dee4bdc0e45 Author: Hao Liu <h...@os.amperecomputing.com> Date: Thu Jun 4 16:28:37 2020 +0800 cselim: Extend to check non-trapping for more references [PR89430] If there is a dominating store, a store to the same reference can not be trapped. But previously, it only supports such check on MEM_REFs. So this patch extends it to support ARRAY_REFs and COMPONENT_REFs. This patch also supports a special case: if there is a dominating load of local variable without address escape, a store is not trapped, as local stack is always writable. Other loads are ignored for simplicity, as they don't help to check if a store can be trapped (the memory may be read-only). gcc/ChangeLog: PR tree-optimization/89430 * tree-ssa-phiopt.c (struct name_to_bb): Rename to ref_to_bb; add a new field exp; remove ssa_name_ver, store, offset fields. (struct ssa_names_hasher): Rename to refs_hasher; update functions. (class nontrapping_dom_walker): Rename m_seen_ssa_names to m_seen_refs. (nontrapping_dom_walker::add_or_mark_expr): Extend to support ARRAY_REFs and COMPONENT_REFs. gcc/testsuite/ChangeLog: PR tree-optimization/89430 * gcc.dg/tree-ssa/pr89430-1.c: Remove xfail. * gcc.dg/tree-ssa/pr89430-2.c: Remove xfail. * gcc.dg/tree-ssa/pr89430-5.c: Remove xfail. * gcc.dg/tree-ssa/pr89430-6.c: Remove xfail. * gcc.dg/tree-ssa/pr89430-7-comp-ref.c: New test. * gcc.dg/tree-ssa/pr89430-8-mem-ref-size.c: New test. * gcc.dg/tree-ssa/ssa-pre-17.c: Add -fno-tree-cselim.