From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7810) id 5ED833858409; Tue, 23 Jan 2024 13:24:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5ED833858409 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706016277; bh=HMDswG9pBKXPqiEZQaAa54Lt3OZAIprKUzE0F3FObTo=; h=From:To:Subject:Date:From; b=R6VUjpLyJwA38HIIghp2sqdQA+fkJydfubCcFvmy7PKiDnZnkwLV+TgnVm8C9uYV8 lpqd21b015ZIWzr+aSmcGi5a/6W5Lpmo2YazA66B9OLaHiA7yYXjtf/4hO/THZaTFh AjMzTXACQdt6GU2u+76NmP8BmNBI0Y8eyFXcQ/Ts= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Alex Coplan To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8358] rtl-ssa: Run finalize_new_accesses forwards [PR113070] X-Act-Checkin: gcc X-Git-Author: Alex Coplan X-Git-Refname: refs/heads/master X-Git-Oldrev: d5d43dc399bb0f15084827c59a025189c630afdd X-Git-Newrev: e0374b028a665a2ea8d6eb2b4e5862774e9e85c2 Message-Id: <20240123132437.5ED833858409@sourceware.org> Date: Tue, 23 Jan 2024 13:24:37 +0000 (GMT) List-Id: https://gcc.gnu.org/g:e0374b028a665a2ea8d6eb2b4e5862774e9e85c2 commit r14-8358-ge0374b028a665a2ea8d6eb2b4e5862774e9e85c2 Author: Alex Coplan Date: Thu Jan 11 16:17:37 2024 +0000 rtl-ssa: Run finalize_new_accesses forwards [PR113070] The next patch in this series exposes an interface for creating new uses in RTL-SSA. The intent is that new user-created uses can consume new user-created defs in the same change group. This is so that we can correctly update uses of memory when inserting a new store pair insn in the aarch64 load/store pair fusion pass (the affected uses need to consume the new store pair insn). As it stands, finalize_new_accesses is called as part of the backwards insn placement loop within change_insns, but if we want new uses to be able to depend on new defs in the same change group, we need finalize_new_accesses to be called on earlier insns first. This is so that when we process temporary uses and turn them into permanent uses, we can follow the last_def link on the temporary def to ensure we end up with a permanent use consuming a permanent def. gcc/ChangeLog: PR target/113070 * rtl-ssa/changes.cc (function_info::change_insns): Split out the call to finalize_new_accesses from the backwards placement loop, run it forwards in a separate loop. Diff: --- gcc/rtl-ssa/changes.cc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/gcc/rtl-ssa/changes.cc b/gcc/rtl-ssa/changes.cc index 2fac45ae885..e538b637848 100644 --- a/gcc/rtl-ssa/changes.cc +++ b/gcc/rtl-ssa/changes.cc @@ -775,15 +775,26 @@ function_info::change_insns (array_slice changes) placeholder = add_placeholder_after (after); following_insn = placeholder; } - - // Finalize the new list of accesses for the change. Don't install - // them yet, so that we still have access to the old lists below. - finalize_new_accesses (change, - placeholder ? placeholder : insn); } placeholders[i] = placeholder; } + // Finalize the new list of accesses for each change. Don't install them yet, + // so that we still have access to the old lists below. + // + // Note that we do this forwards instead of in the backwards loop above so + // that any new defs being inserted are processed before new uses of those + // defs, so that the (initially) temporary uses referring to temporary defs + // can be easily updated to become permanent uses referring to permanent defs. + for (unsigned i = 0; i < changes.size (); i++) + { + insn_change &change = *changes[i]; + insn_info *placeholder = placeholders[i]; + if (!change.is_deletion ()) + finalize_new_accesses (change, + placeholder ? placeholder : change.insn ()); + } + // Remove all definitions that are no longer needed. After the above, // the only uses of such definitions should be dead phis and now-redundant // live-out uses.