From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 299813854E59; Tue, 20 Jun 2023 10:51:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 299813854E59 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687258278; bh=PkJXOQsnyHcfxepnFueq58rKjrN/8u3NkeapUPxfya4=; h=From:To:Subject:Date:From; b=IM+j9Q7h7oGDhWTEVAaUSbWUcwFIJsfkTUBmTYpvJRm3i/fmr0/W7EheQzO1RShcB FkMGMjaI1WfOi7qSPQOjrjOGVGM+m2fsfy8Ra1sYzRwLnBXrEk/SfsUNeesuI9tbmb +sfYI0ihGD3lVQ4RizdveR0sqkMA0dh7UJud6T9I= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1981] Update virtual SSA form manually where easily possible in phiprop X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: 63aaff9b3ab0fed154b2b5ec09f5a0e68c1e5ca7 X-Git-Newrev: 85107abeb71bbf6edc7dfb7691527be104c11735 Message-Id: <20230620105118.299813854E59@sourceware.org> Date: Tue, 20 Jun 2023 10:51:18 +0000 (GMT) List-Id: https://gcc.gnu.org/g:85107abeb71bbf6edc7dfb7691527be104c11735 commit r14-1981-g85107abeb71bbf6edc7dfb7691527be104c11735 Author: Richard Biener Date: Tue Jun 20 09:51:40 2023 +0200 Update virtual SSA form manually where easily possible in phiprop This keeps virtual SSA form up-to-date in phiprop when easily possible. Only when we deal with aggregate copies the work would be too heavy-handed in general. * tree-ssa-phiprop.cc (phiprop_insert_phi): For simple loads keep the virtual SSA form up-to-date. Diff: --- gcc/tree-ssa-phiprop.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/tree-ssa-phiprop.cc b/gcc/tree-ssa-phiprop.cc index 5dc505df420..21a349a25e2 100644 --- a/gcc/tree-ssa-phiprop.cc +++ b/gcc/tree-ssa-phiprop.cc @@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-iterator.h" #include "stor-layout.h" #include "tree-ssa-loop.h" +#include "tree-cfg.h" /* This pass propagates indirect loads through the PHI node for its address to make the load source possibly non-addressable and to @@ -153,6 +154,8 @@ phiprop_insert_phi (basic_block bb, gphi *phi, gimple *use_stmt, print_gimple_stmt (dump_file, use_stmt, 0); } + gphi *vphi = get_virtual_phi (bb); + /* Add PHI arguments for each edge inserting loads of the addressable operands. */ FOR_EACH_EDGE (e, ei, bb->preds) @@ -190,9 +193,20 @@ phiprop_insert_phi (basic_block bb, gphi *phi, gimple *use_stmt, { tree rhs = gimple_assign_rhs1 (use_stmt); gcc_assert (TREE_CODE (old_arg) == ADDR_EXPR); + tree vuse = NULL_TREE; if (TREE_CODE (res) == SSA_NAME) - new_var = make_ssa_name (TREE_TYPE (rhs)); + { + new_var = make_ssa_name (TREE_TYPE (rhs)); + if (vphi) + vuse = PHI_ARG_DEF_FROM_EDGE (vphi, e); + else + vuse = gimple_vuse (use_stmt); + } else + /* For the aggregate copy case updating virtual operands + we'd have to possibly insert a virtual PHI and we have + to split the existing VUSE lifetime. Leave that to + the generic SSA updating. */ new_var = unshare_expr (res); if (!is_gimple_min_invariant (old_arg)) old_arg = PHI_ARG_DEF_FROM_EDGE (phi, e); @@ -203,6 +217,8 @@ phiprop_insert_phi (basic_block bb, gphi *phi, gimple *use_stmt, old_arg, TREE_OPERAND (rhs, 1))); gimple_set_location (tmp, locus); + if (vuse) + gimple_set_vuse (tmp, vuse); gsi_insert_on_edge (e, tmp); update_stmt (tmp);