From patchwork Tue Nov 21 18:00:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manolis Tsamis X-Patchwork-Id: 167863 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp812002vqb; Tue, 21 Nov 2023 10:01:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IEtJy1UIDm/umg2aPU+2dKUM4nCCOwrmcrwDuaNiYxu5oKoxZtGwOpoj7LcIWwdWH06wSJp X-Received: by 2002:ac8:7c43:0:b0:418:79a:e350 with SMTP id o3-20020ac87c43000000b00418079ae350mr13344320qtv.23.1700589690679; Tue, 21 Nov 2023 10:01:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700589690; cv=pass; d=google.com; s=arc-20160816; b=q/ZCiWJ/z2u3MuVw2i7YxBhpLSSApS3db9qXNtBV73a9OFabTAUtgTMXEM4POPyLFT ArNK23+gVMMt8hHl4LhII0F2uxTvMC29LDhdkAEQ1LZ6Gu834GmvL5grEa8hg7OzT6WY XZhKQdhPB6X4qmt01oWK4HjOVu8u1p9v7uulnlNC6YdIpQF2YCgmDEtL/J/mC/fVs2p4 M85UuwxHZA5HamIHAiSzIad5JXexE6jJ/pte3uEp0qbTXVEGbSoC2lGpq199xK8me7W7 bfIgJySZln1U6R8mixBB4Ud4xIQAc6en2XA6Sdc204DZOsuRCkeAwreHjRPEiA1UVzDK KFJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=Ol+ivWhVh4Q0CoCvIsnYPWltb3tF5JCq+mIwyCZ+mJg=; fh=HwHuHKk2Z+oSXGqWcrPxaOLknFcma6ZkpPZxTV7iKHc=; b=FH3Mmhyg/U2iYbgBvBE+DTmMU/xlfzq0p5vtSVdHwqZ4fDUR6NgpfUIEq46PH+9hNY 7THcM8/ZJYtdGmPf7heXwRMurPEuAPDhjoY7u9VB5Cn5Q/zl+cIdv2G4PPGOKNX0B1lO inHXcVYi+9V6lmYQuOXwTwqmWsSzkSlVLQB6zDN3r230EJF0Fxqv+0sTOUcypyXoVfYi LG8QrvC+b0y0RqFDyvWXrIOcqsxsbYMD42chCZPHDClZmDFWQasycwKThz05YTaS3TVT JU/ZUuEiMFTtWpH+0na7PypQxbqLIq4ZBfYOHdRlAYriiij+LlMLRcZxzIFnuAOpNr2k SHdA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vrull.eu header.s=google header.b=NbO3X0R2; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id v13-20020ac8578d000000b0041b83912a5dsi9989814qta.187.2023.11.21.10.01.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 10:01:30 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@vrull.eu header.s=google header.b=NbO3X0R2; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 454E73858296 for ; Tue, 21 Nov 2023 18:01:29 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by sourceware.org (Postfix) with ESMTPS id 0AA203858D37 for ; Tue, 21 Nov 2023 18:01:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0AA203858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0AA203858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::134 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700589665; cv=none; b=L0JXo6gwGsHe3JiOLGYvquuDqloZdyTTLbzCwDSHfH/NiFGkXwlS2Z+0TifQn7cD+Yxl++Zkf3fuGxfOb0hBBLNYe4oAqBAjgrTIvWc2Rg/IRXJVsy7Y2yenBRRxcoHb/fqbTVys9tT+WxIpGfWL7z5PpbxgOy//byP0NeNR81s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700589665; c=relaxed/simple; bh=arX6jU1IS6xP/YxtsXC8gShbWMnB43qD0uk3gUCP61A=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=wwd4KBV0qBccO3hMUQvucCv1zpf6j3dJcKFyGC4a1DHUdbV0WmikiKZf7avJQ43V91r6/eUG3ehUZLY/HZzoEMnUrw4Vnp/xExh8agMUHSLehNWjEveYQOjkr3wq+/0j4Dl+9TqLSsbboOQCM5UT5FZIh3tQ/wd+HH1qlJyWXrY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-507e85ebf50so7683578e87.1 for ; Tue, 21 Nov 2023 10:01:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1700589659; x=1701194459; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Ol+ivWhVh4Q0CoCvIsnYPWltb3tF5JCq+mIwyCZ+mJg=; b=NbO3X0R2jmUnLct9fL44Cghjidr26/Wu+MNx3Bmf/bPV3BFEEImfHB7IYQC6obimDR EVuFlgOfkFZubPWU32SL0MBdrHqm3th3GNtIZSXMOcs/LuaEJGwd8AlKgIgK4cF68Fiz z55aoZwq4KYOg89B8F6N9dvw2JVv4whynyH8j4+zzABNF1FfM1I7XINcY/Op45oxw7d9 Vdn+70oX3aPmzFrUf0lyVWCrKug5y7tD89g2to0/6g5G/48z0VpBwX5KJbh0R+Gim7qc N/mcpnA2IoTggJDSMlTHkHUMdizAQmN+5wp/gbVu4tx23MxA8Xxy3oBnk9fLAloFNt5U wEbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700589659; x=1701194459; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Ol+ivWhVh4Q0CoCvIsnYPWltb3tF5JCq+mIwyCZ+mJg=; b=jT8qtFVW5qG3bwVISTnFaSFdn1FHNc6ADAZgoKZPXTWOgiVeT3JD/rIyf62u8ONZxc cbesWQ7mysARqtZLEt6xgx5NdRhZRL4M3XPiys9rDDEpd0Rp93r5kMVn+2Wtw7w8kzOL jOrDsBSI8mUJKMMKZryD5mu5oS5BOwuzVAN7zeADIkE2tMQoNC7UeqQA7pbtn4FSxvRG tGvod6DzpmsXjE4fJQ0H63BhderWw2OkB5gtLN3VOU3tpFFNvBVXLlNOCCWw5Ethxx8n glRpt+Cjsd/UuhXz8mkcWUKYzk16ot16GheL/XBQBUqr3VdHH3mNHJzGAoNi9W/elD/T 3qFw== X-Gm-Message-State: AOJu0Yy0rVRgo4FpJnyPEvmuw44WB4C3BB7mTl3BF1tztgukmiTExM3K DaTp5imVcKrccivAO7t2PX3kc/mKvf/kzLS8uuk= X-Received: by 2002:ac2:43d0:0:b0:507:b935:9f60 with SMTP id u16-20020ac243d0000000b00507b9359f60mr7828815lfl.57.1700589658834; Tue, 21 Nov 2023 10:00:58 -0800 (PST) Received: from helsinki-03.engr ([2a01:4f9:6b:2a47::2]) by smtp.gmail.com with ESMTPSA id z15-20020a056512376f00b005079a4cf2c1sm1583271lft.239.2023.11.21.10.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 10:00:58 -0800 (PST) From: Manolis Tsamis To: gcc-patches@gcc.gnu.org Cc: Robin Dapp , Jeff Law , Philipp Tomsich , Richard Sandiford , Manolis Tsamis Subject: [PATCH v2] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets Date: Tue, 21 Nov 2023 19:00:54 +0100 Message-Id: <20231121180054.3949602-1-manolis.tsamis@vrull.eu> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783197535354320350 X-GMAIL-MSGID: 1783197535354320350 The existing implementation of need_cmov_or_rewire and noce_convert_multiple_sets_1 assumes that sets are either REG or SUBREG. This commit enchances them so they can handle/rewire arbitrary set statements. To do that a new helper struct noce_multiple_sets_info is introduced which is used by noce_convert_multiple_sets and its helper functions. This results in cleaner function signatures, improved efficientcy (a number of vecs and hash set/map are replaced with a single vec of struct) and simplicity. gcc/ChangeLog: * ifcvt.cc (need_cmov_or_rewire): Renamed init_noce_multiple_sets_info. (init_noce_multiple_sets_info): Initialize noce_multiple_sets_info. (noce_convert_multiple_sets_1): Use noce_multiple_sets_info and handle rewiring of multiple registers. (noce_convert_multiple_sets): Updated to use noce_multiple_sets_info. * ifcvt.h (struct noce_multiple_sets_info): Introduce new struct noce_multiple_sets_info to store info for noce_convert_multiple_sets. Signed-off-by: Manolis Tsamis --- Changes in v2: - Made standalone patch. - Better comments, some more checks. gcc/ifcvt.cc | 252 +++++++++++++++++++++++---------------------------- gcc/ifcvt.h | 16 ++++ 2 files changed, 129 insertions(+), 139 deletions(-) diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc index a0af553b9ff..9486d54de34 100644 --- a/gcc/ifcvt.cc +++ b/gcc/ifcvt.cc @@ -98,14 +98,10 @@ static bool dead_or_predicable (basic_block, basic_block, basic_block, edge, bool); static void noce_emit_move_insn (rtx, rtx); static rtx_insn *block_has_only_trap (basic_block); -static void need_cmov_or_rewire (basic_block, hash_set *, - hash_map *); +static void init_noce_multiple_sets_info (basic_block, + auto_delete_vec &); static bool noce_convert_multiple_sets_1 (struct noce_if_info *, - hash_set *, - hash_map *, - auto_vec *, - auto_vec *, - auto_vec *, int *); + auto_delete_vec &, int *); /* Count the number of non-jump active insns in BB. */ @@ -3270,24 +3266,13 @@ noce_convert_multiple_sets (struct noce_if_info *if_info) rtx x = XEXP (cond, 0); rtx y = XEXP (cond, 1); - /* The true targets for a conditional move. */ - auto_vec targets; - /* The temporaries introduced to allow us to not consider register - overlap. */ - auto_vec temporaries; - /* The insns we've emitted. */ - auto_vec unmodified_insns; - - hash_set need_no_cmov; - hash_map rewired_src; - - need_cmov_or_rewire (then_bb, &need_no_cmov, &rewired_src); + auto_delete_vec insn_info; + init_noce_multiple_sets_info (then_bb, insn_info); int last_needs_comparison = -1; bool ok = noce_convert_multiple_sets_1 - (if_info, &need_no_cmov, &rewired_src, &targets, &temporaries, - &unmodified_insns, &last_needs_comparison); + (if_info, insn_info, &last_needs_comparison); if (!ok) return false; @@ -3302,8 +3287,7 @@ noce_convert_multiple_sets (struct noce_if_info *if_info) end_sequence (); start_sequence (); ok = noce_convert_multiple_sets_1 - (if_info, &need_no_cmov, &rewired_src, &targets, &temporaries, - &unmodified_insns, &last_needs_comparison); + (if_info, insn_info, &last_needs_comparison); /* Actually we should not fail anymore if we reached here, but better still check. */ if (!ok) @@ -3312,12 +3296,12 @@ noce_convert_multiple_sets (struct noce_if_info *if_info) /* We must have seen some sort of insn to insert, otherwise we were given an empty BB to convert, and we can't handle that. */ - gcc_assert (!unmodified_insns.is_empty ()); + gcc_assert (!insn_info.is_empty ()); /* Now fixup the assignments. */ - for (unsigned i = 0; i < targets.length (); i++) - if (targets[i] != temporaries[i]) - noce_emit_move_insn (targets[i], temporaries[i]); + for (unsigned i = 0; i < insn_info.length (); i++) + if (insn_info[i]->target != insn_info[i]->temporary) + noce_emit_move_insn (insn_info[i]->target, insn_info[i]->temporary); /* Actually emit the sequence if it isn't too expensive. */ rtx_insn *seq = get_insns (); @@ -3332,10 +3316,10 @@ noce_convert_multiple_sets (struct noce_if_info *if_info) set_used_flags (insn); /* Mark all our temporaries and targets as used. */ - for (unsigned i = 0; i < targets.length (); i++) + for (unsigned i = 0; i < insn_info.length (); i++) { - set_used_flags (temporaries[i]); - set_used_flags (targets[i]); + set_used_flags (insn_info[i]->temporary); + set_used_flags (insn_info[i]->target); } set_used_flags (cond); @@ -3354,7 +3338,7 @@ noce_convert_multiple_sets (struct noce_if_info *if_info) return false; emit_insn_before_setloc (seq, if_info->jump, - INSN_LOCATION (unmodified_insns.last ())); + INSN_LOCATION (insn_info.last ()->unmodified_insn)); /* Clean up THEN_BB and the edges in and out of it. */ remove_edge (find_edge (test_bb, join_bb)); @@ -3389,21 +3373,13 @@ check_for_cc_cmp_clobbers (rtx dest, const_rtx, void *p0) p[0] = NULL_RTX; } -/* This goes through all relevant insns of IF_INFO->then_bb and tries to - create conditional moves. In case a simple move sufficis the insn - should be listed in NEED_NO_CMOV. The rewired-src cases should be - specified via REWIRED_SRC. TARGETS, TEMPORARIES and UNMODIFIED_INSNS - are specified and used in noce_convert_multiple_sets and should be passed - to this function.. */ +/* This goes through all relevant insns of IF_INFO->then_bb and tries to create + conditional moves. Information for the insns is kept in INSN_INFO. */ static bool noce_convert_multiple_sets_1 (struct noce_if_info *if_info, - hash_set *need_no_cmov, - hash_map *rewired_src, - auto_vec *targets, - auto_vec *temporaries, - auto_vec *unmodified_insns, - int *last_needs_comparison) + auto_delete_vec &insn_info, + int *last_needs_comparison) { basic_block then_bb = if_info->then_bb; rtx_insn *jump = if_info->jump; @@ -3421,11 +3397,6 @@ noce_convert_multiple_sets_1 (struct noce_if_info *if_info, rtx_insn *insn; int count = 0; - - targets->truncate (0); - temporaries->truncate (0); - unmodified_insns->truncate (0); - bool second_try = *last_needs_comparison != -1; FOR_BB_INSNS (then_bb, insn) @@ -3434,6 +3405,8 @@ noce_convert_multiple_sets_1 (struct noce_if_info *if_info, if (!active_insn_p (insn)) continue; + noce_multiple_sets_info *info = insn_info[count]; + rtx set = single_set (insn); gcc_checking_assert (set); @@ -3441,9 +3414,12 @@ noce_convert_multiple_sets_1 (struct noce_if_info *if_info, rtx temp; rtx new_val = SET_SRC (set); - if (int *ii = rewired_src->get (insn)) - new_val = simplify_replace_rtx (new_val, (*targets)[*ii], - (*temporaries)[*ii]); + + int i, ii; + FOR_EACH_VEC_ELT (info->rewired_src, i, ii) + new_val = simplify_replace_rtx (new_val, insn_info[ii]->target, + insn_info[ii]->temporary); + rtx old_val = target; /* As we are transforming @@ -3484,7 +3460,7 @@ noce_convert_multiple_sets_1 (struct noce_if_info *if_info, /* We have identified swap-style idioms before. A normal set will need to be a cmov while the first instruction of a swap-style idiom can be a regular move. This helps with costing. */ - bool need_cmov = !need_no_cmov->contains (insn); + bool need_cmov = info->need_cmov; /* If we had a non-canonical conditional jump (i.e. one where the fallthrough is to the "else" case) we need to reverse @@ -3632,21 +3608,102 @@ noce_convert_multiple_sets_1 (struct noce_if_info *if_info, /* Bookkeeping. */ count++; - targets->safe_push (target); - temporaries->safe_push (temp_dest); - unmodified_insns->safe_push (insn); + + info->target = target; + info->temporary = temp_dest; + info->unmodified_insn = insn; } + /* The number of processed insns must match init_noce_multiple_sets_info. */ + gcc_assert (count == (int) insn_info.length ()); + /* Even if we did not actually need the comparison, we want to make sure to try a second time in order to get rid of the temporaries. */ if (*last_needs_comparison == -1) *last_needs_comparison = 0; - return true; } +/* Find local swap-style idioms in BB and mark the first insn (1) + that is only a temporary as not needing a conditional move as + it is going to be dead afterwards anyway. + + (1) int tmp = a; + a = b; + b = tmp; + + ifcvt + --> + + tmp = a; + a = cond ? b : a_old; + b = cond ? tmp : b_old; + + Additionally, store the index of insns like (2) when a subsequent + SET reads from their destination. + (2) int c = a; + int d = c; + + ifcvt + --> + + c = cond ? a : c_old; + d = cond ? d : c; // Need to use c rather than c_old here. +*/ + +static void +init_noce_multiple_sets_info (basic_block bb, + auto_delete_vec &insn_info) +{ + rtx_insn *insn; + int count = 0; + auto_vec dests; + + /* Iterate over all SETs, storing the destinations + in DEST. + - If we hit a SET that reads from a destination + that we have seen before and the corresponding register + is dead afterwards, the register does not need to be + moved conditionally. + - If we encounter a previously changed register, + rewire the read to the original source. */ + FOR_BB_INSNS (bb, insn) + { + if (!active_insn_p (insn)) + continue; + + noce_multiple_sets_info *info = new noce_multiple_sets_info; + info->target = NULL_RTX; + info->temporary = NULL_RTX; + info->unmodified_insn = NULL; + info->need_cmov = true; + insn_info.safe_push (info); + + rtx set = single_set (insn); + gcc_checking_assert (set); + + rtx src = SET_SRC (set); + rtx dest = SET_DEST (set); + + /* Check if the current SET's source is the same + as any previously seen destination. + This is quadratic but the number of insns in BB + is bounded by PARAM_MAX_RTL_IF_CONVERSION_INSNS. */ + for (int i = count - 1; i >= 0; --i) + if (reg_mentioned_p (dests[i], src)) + { + if (find_reg_note (insn, REG_DEAD, src) != NULL_RTX) + insn_info[i]->need_cmov = false; + else + insn_info[count]->rewired_src.safe_push (i); + } + + dests.safe_push (dest); + count++; + } +} /* Return true iff basic block TEST_BB is comprised of only (SET (REG) (REG)) insns suitable for conversion to a series @@ -4121,89 +4178,6 @@ check_cond_move_block (basic_block bb, return true; } -/* Find local swap-style idioms in BB and mark the first insn (1) - that is only a temporary as not needing a conditional move as - it is going to be dead afterwards anyway. - - (1) int tmp = a; - a = b; - b = tmp; - - ifcvt - --> - - tmp = a; - a = cond ? b : a_old; - b = cond ? tmp : b_old; - - Additionally, store the index of insns like (2) when a subsequent - SET reads from their destination. - - (2) int c = a; - int d = c; - - ifcvt - --> - - c = cond ? a : c_old; - d = cond ? d : c; // Need to use c rather than c_old here. -*/ - -static void -need_cmov_or_rewire (basic_block bb, - hash_set *need_no_cmov, - hash_map *rewired_src) -{ - rtx_insn *insn; - int count = 0; - auto_vec insns; - auto_vec dests; - - /* Iterate over all SETs, storing the destinations - in DEST. - - If we hit a SET that reads from a destination - that we have seen before and the corresponding register - is dead afterwards, the register does not need to be - moved conditionally. - - If we encounter a previously changed register, - rewire the read to the original source. */ - FOR_BB_INSNS (bb, insn) - { - rtx set, src, dest; - - if (!active_insn_p (insn)) - continue; - - set = single_set (insn); - if (set == NULL_RTX) - continue; - - src = SET_SRC (set); - if (SUBREG_P (src)) - src = SUBREG_REG (src); - dest = SET_DEST (set); - - /* Check if the current SET's source is the same - as any previously seen destination. - This is quadratic but the number of insns in BB - is bounded by PARAM_MAX_RTL_IF_CONVERSION_INSNS. */ - if (REG_P (src)) - for (int i = count - 1; i >= 0; --i) - if (reg_overlap_mentioned_p (src, dests[i])) - { - if (find_reg_note (insn, REG_DEAD, src) != NULL_RTX) - need_no_cmov->add (insns[i]); - else - rewired_src->put (insn, i); - } - - insns.safe_push (insn); - dests.safe_push (dest); - - count++; - } -} - /* Given a basic block BB suitable for conditional move conversion, a condition COND, and pointer maps THEN_VALS and ELSE_VALS containing the register values depending on COND, emit the insns in the block as diff --git a/gcc/ifcvt.h b/gcc/ifcvt.h index be1385aabe4..83420fe1207 100644 --- a/gcc/ifcvt.h +++ b/gcc/ifcvt.h @@ -40,6 +40,22 @@ struct ce_if_block int pass; /* Pass number. */ }; +struct noce_multiple_sets_info +{ + /* A list of indices to instructions that we need to rewire into this + instruction when we replace them with temporary conditional moves. */ + auto_vec rewired_src; + /* The true targets for a conditional move. */ + rtx target; + /* The temporary introduced for this conditional move. */ + rtx temporary; + /* The original instruction that we're replacing. */ + rtx_insn *unmodified_insn; + /* True if a conditional move is needed. + False if a simple move can be used instead. */ + bool need_cmov; +}; + /* Used by noce_process_if_block to communicate with its subroutines. The subroutines know that A and B may be evaluated freely. They