From patchwork Wed Oct 27 06:34:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xionghu Luo X-Patchwork-Id: 46690 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D98D33857C5B for ; Wed, 27 Oct 2021 06:37:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D98D33857C5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635316654; bh=OJp4e1Rgr0DL/flbhf6pZ9Q2COF9UXZmDUDLdDT/l7o=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=JFVoucs2771kXzHDy6hn602hKJtp1dRf8917k1X4BhJ9P1xTiXe81C1If14N3fdy5 TAZtkLJkhg1PsUTZZg0QoeHPdPlnC1kF0TNpXFq84+TjAn30ZdiGerTNoPEx21NiWj w2kBshN5xUtgo3SZABJIm4M6eiGQvLhwRbpasnXU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id A84FF3858429; Wed, 27 Oct 2021 06:36:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A84FF3858429 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19R5rn6x032587; Wed, 27 Oct 2021 06:36:00 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3by1148twu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 06:36:00 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19R6IcR4032747; Wed, 27 Oct 2021 06:36:00 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 3by1148tvx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 06:35:59 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 19R6R18V008805; Wed, 27 Oct 2021 06:35:57 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma01fra.de.ibm.com with ESMTP id 3bx4f2b59k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 06:35:57 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19R6ZsDm59441624 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Oct 2021 06:35:54 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 517EC4C044; Wed, 27 Oct 2021 06:35:54 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E905D4C040; Wed, 27 Oct 2021 06:35:52 +0000 (GMT) Received: from marlin.aus.stglabs.ibm.com (unknown [9.40.194.84]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 27 Oct 2021 06:35:52 +0000 (GMT) To: gcc-patches@gcc.gnu.org Subject: [PATCH v2 1/4] Fix loop split incorrect count and probability Date: Wed, 27 Oct 2021 01:34:45 -0500 Message-Id: <20211027063448.1844771-2-luoxhu@linux.ibm.com> X-Mailer: git-send-email 2.27.0.90.geebb51ba8c In-Reply-To: <20211027063448.1844771-1-luoxhu@linux.ibm.com> References: <20211027063448.1844771-1-luoxhu@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: fyWVvkXEUnFrELApfzJqkV0pf4y05CpM X-Proofpoint-ORIG-GUID: XVYdw00hd7-9-1UE7wwFseyChCOvhG8I X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-27_02,2021-10-26_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 suspectscore=0 impostorscore=0 adultscore=0 lowpriorityscore=0 spamscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2110270038 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xionghu Luo via Gcc-patches From: Xionghu Luo Reply-To: Xionghu Luo Cc: rguenther@suse.de, segher@kernel.crashing.org, Xionghu Luo , hubicka@kam.mff.cuni.cz, wschmidt@linux.ibm.com, linkw@gcc.gnu.org, dje.gcc@gmail.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" loop split condition is moved between loop1 and loop2, the split bb's count and probability should also be duplicated instead of (100% vs INV), secondly, the original loop1 and loop2 count need be propotional from the original loop. Regression tested pass, OK for master? diff base/loop-cond-split-1.c.151t.lsplit patched/loop-cond-split-1.c.151t.lsplit: ... int prephitmp_16; int prephitmp_25; [local count: 118111600]: if (n_7(D) > 0) goto ; [89.00%] else goto ; [11.00%] [local count: 118111600]: return; [local count: 105119324]: pretmp_3 = ga; - [local count: 955630225]: + [local count: 315357973]: # i_13 = PHI # prephitmp_12 = PHI if (prephitmp_12 != 0) goto ; [33.00%] else goto ; [67.00%] - [local count: 315357972]: + [local count: 104068130]: _2 = do_something (); ga = _2; - [local count: 955630225]: + [local count: 315357973]: # prephitmp_5 = PHI i_10 = inc (i_13); if (n_7(D) > i_10) goto ; [89.00%] else goto ; [11.00%] [local count: 105119324]: goto ; [100.00%] - [local count: 850510901]: + [local count: 280668596]: if (prephitmp_12 != 0) - goto ; [100.00%] + goto ; [33.00%] else - goto ; [INV] + goto ; [67.00%] - [local count: 850510901]: + [local count: 280668596]: goto ; [100.00%] - [count: 0]: + [local count: 70429947]: # i_23 = PHI # prephitmp_25 = PHI - [local count: 955630225]: + [local count: 640272252]: # i_15 = PHI # prephitmp_16 = PHI i_22 = inc (i_15); if (n_7(D) > i_22) goto ; [89.00%] else goto ; [11.00%] - [local count: 850510901]: + [local count: 569842305]: goto ; [100.00%] } gcc/ChangeLog: * tree-ssa-loop-split.c (split_loop): Fix incorrect probability. (do_split_loop_on_cond): Likewise. --- gcc/tree-ssa-loop-split.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c index 3f6ad046623..d30782888f3 100644 --- a/gcc/tree-ssa-loop-split.c +++ b/gcc/tree-ssa-loop-split.c @@ -575,7 +575,11 @@ split_loop (class loop *loop1) stmts2); tree cond = build2 (guard_code, boolean_type_node, guard_init, border); if (!initial_true) - cond = fold_build1 (TRUTH_NOT_EXPR, boolean_type_node, cond); + cond = fold_build1 (TRUTH_NOT_EXPR, boolean_type_node, cond); + + edge true_edge = EDGE_SUCC (bbs[i], 0)->flags & EDGE_TRUE_VALUE + ? EDGE_SUCC (bbs[i], 0) + : EDGE_SUCC (bbs[i], 1); /* Now version the loop, placing loop2 after loop1 connecting them, and fix up SSA form for that. */ @@ -583,10 +587,10 @@ split_loop (class loop *loop1) basic_block cond_bb; class loop *loop2 = loop_version (loop1, cond, &cond_bb, - profile_probability::always (), - profile_probability::always (), - profile_probability::always (), - profile_probability::always (), + true_edge->probability, + true_edge->probability.invert (), + true_edge->probability, + true_edge->probability.invert (), true); gcc_assert (loop2); @@ -1486,10 +1490,10 @@ do_split_loop_on_cond (struct loop *loop1, edge invar_branch) initialize_original_copy_tables (); struct loop *loop2 = loop_version (loop1, boolean_true_node, NULL, - profile_probability::always (), - profile_probability::never (), - profile_probability::always (), - profile_probability::always (), + invar_branch->probability.invert (), + invar_branch->probability, + invar_branch->probability.invert (), + invar_branch->probability, true); if (!loop2) { @@ -1530,6 +1534,9 @@ do_split_loop_on_cond (struct loop *loop1, edge invar_branch) to_loop1->flags |= true_invar ? EDGE_FALSE_VALUE : EDGE_TRUE_VALUE; to_loop2->flags |= true_invar ? EDGE_TRUE_VALUE : EDGE_FALSE_VALUE; + to_loop1->probability = invar_branch->probability.invert (); + to_loop2->probability = invar_branch->probability; + /* Due to introduction of a control flow edge from loop1 latch to loop2 pre-header, we should update PHIs in loop2 to reflect this connection between loop1 and loop2. */ From patchwork Wed Oct 27 06:34:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xionghu Luo X-Patchwork-Id: 46691 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 05D23385700D for ; Wed, 27 Oct 2021 06:38:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 05D23385700D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635316712; bh=HbsKIRnamUtt3n0I1EpRHfyWWZRePtwjtm+6J0Ox0dw=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=vRBkT5VKbj8oISUJe+I9527bKklcUEukrYLTlAGBnE7Pb7R65byoKzP8vN2pIuo49 oX5jzo79Agj6YR0BUpLARMcrGJ6UxkuyK/yJaOmZruSNfcDz4XwjKOUI6e5ppYg8Qp 3I8k1eS5QiWQGnB14bWAAX989OceGsTRkPU5WqUw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 8A18A385780A; Wed, 27 Oct 2021 06:36:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8A18A385780A Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19R5Gvfs006294; Wed, 27 Oct 2021 06:36:02 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3by0g01pab-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 06:36:02 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19R6LroP030738; Wed, 27 Oct 2021 06:36:02 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 3by0g01p9d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 06:36:01 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 19R6STIR012387; Wed, 27 Oct 2021 06:35:59 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03ams.nl.ibm.com with ESMTP id 3bx4et3yfd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 06:35:59 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19R6ZuJv50856232 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Oct 2021 06:35:56 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 13A394C066; Wed, 27 Oct 2021 06:35:56 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 98B3D4C04A; Wed, 27 Oct 2021 06:35:54 +0000 (GMT) Received: from marlin.aus.stglabs.ibm.com (unknown [9.40.194.84]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 27 Oct 2021 06:35:54 +0000 (GMT) To: gcc-patches@gcc.gnu.org Subject: [PATCH v2 2/4] Refactor loop_version Date: Wed, 27 Oct 2021 01:34:46 -0500 Message-Id: <20211027063448.1844771-3-luoxhu@linux.ibm.com> X-Mailer: git-send-email 2.27.0.90.geebb51ba8c In-Reply-To: <20211027063448.1844771-1-luoxhu@linux.ibm.com> References: <20211027063448.1844771-1-luoxhu@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 6bGaesZo3OUmgH3QF4OLLQDu7uQFRSIH X-Proofpoint-GUID: K4IvvrrQx6FVuZw8l5kPIrUtKH5DXgRA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-27_01,2021-10-26_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 adultscore=0 spamscore=0 mlxscore=0 malwarescore=0 bulkscore=0 clxscore=1015 suspectscore=0 mlxlogscore=999 priorityscore=1501 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2110270038 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xionghu Luo via Gcc-patches From: Xionghu Luo Reply-To: Xionghu Luo Cc: rguenther@suse.de, segher@kernel.crashing.org, Xionghu Luo , hubicka@kam.mff.cuni.cz, wschmidt@linux.ibm.com, linkw@gcc.gnu.org, dje.gcc@gmail.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" loop_version currently does lv_adjust_loop_entry_edge before it loopifys the copy inserted on the header. This patch moves the condition generation later and thus we have four pieces to help understanding of how the adjustment works: 1) duplicating the loop on the entry edge. 2) loopify the duplicated new loop. 3) adjusting the CFG to insert a condition branching to either loop with lv_adjust_loop_entry_edge. 4) From loopify extract the scale_loop_frequencies bits. Also removed some piece of code seems obviously useless which is not completely sure: - redirect_all_edges since it is false and loopify only called once. - extract_cond_bb_edges and lv_flush_pending_stmts (false_edge) as the edge is not redirected actually. gcc/ChangeLog: * cfgloopmanip.c (loop_version): Refactor loopify to loop_version. Move condition generation after loopify. (loopify): Delete. * cfgloopmanip.h (loopify): Delete. --- gcc/cfgloopmanip.c | 113 ++++++++++++--------------------------------- gcc/cfgloopmanip.h | 3 -- 2 files changed, 29 insertions(+), 87 deletions(-) diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index 82c242dd720..a30ebe1cdb4 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -846,71 +846,6 @@ create_empty_loop_on_edge (edge entry_edge, return loop; } -/* Make area between HEADER_EDGE and LATCH_EDGE a loop by connecting - latch to header and update loop tree and dominators - accordingly. Everything between them plus LATCH_EDGE destination must - be dominated by HEADER_EDGE destination, and back-reachable from - LATCH_EDGE source. HEADER_EDGE is redirected to basic block SWITCH_BB, - FALSE_EDGE of SWITCH_BB to original destination of HEADER_EDGE and - TRUE_EDGE of SWITCH_BB to original destination of LATCH_EDGE. - Returns the newly created loop. Frequencies and counts in the new loop - are scaled by FALSE_SCALE and in the old one by TRUE_SCALE. */ - -class loop * -loopify (edge latch_edge, edge header_edge, - basic_block switch_bb, edge true_edge, edge false_edge, - bool redirect_all_edges, profile_probability true_scale, - profile_probability false_scale) -{ - basic_block succ_bb = latch_edge->dest; - basic_block pred_bb = header_edge->src; - class loop *loop = alloc_loop (); - class loop *outer = loop_outer (succ_bb->loop_father); - profile_count cnt; - - loop->header = header_edge->dest; - loop->latch = latch_edge->src; - - cnt = header_edge->count (); - - /* Redirect edges. */ - loop_redirect_edge (latch_edge, loop->header); - loop_redirect_edge (true_edge, succ_bb); - - /* During loop versioning, one of the switch_bb edge is already properly - set. Do not redirect it again unless redirect_all_edges is true. */ - if (redirect_all_edges) - { - loop_redirect_edge (header_edge, switch_bb); - loop_redirect_edge (false_edge, loop->header); - - /* Update dominators. */ - set_immediate_dominator (CDI_DOMINATORS, switch_bb, pred_bb); - set_immediate_dominator (CDI_DOMINATORS, loop->header, switch_bb); - } - - set_immediate_dominator (CDI_DOMINATORS, succ_bb, switch_bb); - - /* Compute new loop. */ - add_loop (loop, outer); - - /* Add switch_bb to appropriate loop. */ - if (switch_bb->loop_father) - remove_bb_from_loops (switch_bb); - add_bb_to_loop (switch_bb, outer); - - /* Fix counts. */ - if (redirect_all_edges) - { - switch_bb->count = cnt; - } - scale_loop_frequencies (loop, false_scale); - scale_loop_frequencies (succ_bb->loop_father, true_scale); - update_dominators_in_loop (loop); - - return loop; -} - /* Remove the latch edge of a LOOP and update loops to indicate that the LOOP was removed. After this function, original loop latch will have no successor, which caller is expected to fix somehow. @@ -1681,7 +1616,7 @@ loop_version (class loop *loop, bool place_after) { basic_block first_head, second_head; - edge entry, latch_edge, true_edge, false_edge; + edge entry, latch_edge; int irred_flag; class loop *nloop; basic_block cond_bb; @@ -1694,7 +1629,7 @@ loop_version (class loop *loop, /* Note down head of loop as first_head. */ first_head = entry->dest; - /* Duplicate loop. */ + /* 1) Duplicate loop on the entry edge. */ if (!cfg_hook_duplicate_loop_to_header_edge (loop, entry, 1, NULL, NULL, NULL, 0)) { @@ -1702,11 +1637,28 @@ loop_version (class loop *loop, return NULL; } + /* 2) loopify the duplicated new loop. */ + latch_edge = single_succ_edge (get_bb_copy (loop->latch)); + nloop = alloc_loop (); + class loop *outer = loop_outer (latch_edge->dest->loop_father); + edge new_header_edge = single_pred_edge (get_bb_copy (loop->header)); + nloop->header = new_header_edge->dest; + nloop->latch = latch_edge->src; + loop_redirect_edge (latch_edge, nloop->header); + + /* Compute new loop. */ + add_loop (nloop, outer); + copy_loop_info (loop, nloop); + set_loop_copy (loop, nloop); + + /* loopify redirected latch_edge. Update its PENDING_STMTS. */ + lv_flush_pending_stmts (latch_edge); + /* After duplication entry edge now points to new loop head block. Note down new head as second_head. */ second_head = entry->dest; - /* Split loop entry edge and insert new block with cond expr. */ + /* 3) Split loop entry edge and insert new block with cond expr. */ cond_bb = lv_adjust_loop_entry_edge (first_head, second_head, entry, cond_expr, then_prob, else_prob); if (condition_bb) @@ -1718,24 +1670,17 @@ loop_version (class loop *loop, return NULL; } - latch_edge = single_succ_edge (get_bb_copy (loop->latch)); - - extract_cond_bb_edges (cond_bb, &true_edge, &false_edge); - nloop = loopify (latch_edge, - single_pred_edge (get_bb_copy (loop->header)), - cond_bb, true_edge, false_edge, - false /* Do not redirect all edges. */, - then_scale, else_scale); - - copy_loop_info (loop, nloop); - set_loop_copy (loop, nloop); + /* Add cond_bb to appropriate loop. */ + if (cond_bb->loop_father) + remove_bb_from_loops (cond_bb); + add_bb_to_loop (cond_bb, outer); - /* loopify redirected latch_edge. Update its PENDING_STMTS. */ - lv_flush_pending_stmts (latch_edge); + /* 4) Scale the original loop and new loop frequency. */ + scale_loop_frequencies (loop, then_scale); + scale_loop_frequencies (nloop, else_scale); + update_dominators_in_loop (loop); + update_dominators_in_loop (nloop); - /* loopify redirected condition_bb's succ edge. Update its PENDING_STMTS. */ - extract_cond_bb_edges (cond_bb, &true_edge, &false_edge); - lv_flush_pending_stmts (false_edge); /* Adjust irreducible flag. */ if (irred_flag) { diff --git a/gcc/cfgloopmanip.h b/gcc/cfgloopmanip.h index 07d5f925b79..312a3b48d05 100644 --- a/gcc/cfgloopmanip.h +++ b/gcc/cfgloopmanip.h @@ -42,9 +42,6 @@ extern void scale_loop_profile (class loop *, profile_probability, gcov_type); extern edge create_empty_if_region_on_edge (edge, tree); extern class loop *create_empty_loop_on_edge (edge, tree, tree, tree, tree, tree *, tree *, class loop *); -extern class loop *loopify (edge, edge, - basic_block, edge, edge, bool, - profile_probability, profile_probability); extern void unloop (class loop *, bool *, bitmap); extern void copy_loop_info (class loop *loop, class loop *target); extern class loop * duplicate_loop (class loop *, class loop *, From patchwork Wed Oct 27 06:34:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xionghu Luo X-Patchwork-Id: 46692 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 425AA3857011 for ; Wed, 27 Oct 2021 06:39:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 425AA3857011 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635316769; bh=1hJkiNq08nZDUSw8g9mpCrkXof5hqPf2gH08yLpKi5s=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=jQuZnpCn+AH24BmPbs8/r4cR/8Qt8jp7tfIQ8jB+eaXaaxWEq91TS70zobPAA6t1K 1jD9+8DUXw0WuEn9x6in/QS8DGuguTnudY8qes5JtU2ijnECfPLTibv1a0X0mBNPYD HTMVkRHEm2qMMOOg7ljpcU81N9zdFGz+eCYRKVFA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 493A3385700D; Wed, 27 Oct 2021 06:36:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 493A3385700D Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19R6Oebo016362; Wed, 27 Oct 2021 06:36:04 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3by1fj06tq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 06:36:04 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19R6ZLiv023522; Wed, 27 Oct 2021 06:36:03 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 3by1fj06sx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 06:36:03 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 19R6R1iN008816; Wed, 27 Oct 2021 06:36:01 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma01fra.de.ibm.com with ESMTP id 3bx4f2b5a1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 06:36:01 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19R6Zvm662194044 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Oct 2021 06:35:57 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B65C54C050; Wed, 27 Oct 2021 06:35:57 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5119A4C05A; Wed, 27 Oct 2021 06:35:56 +0000 (GMT) Received: from marlin.aus.stglabs.ibm.com (unknown [9.40.194.84]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 27 Oct 2021 06:35:56 +0000 (GMT) To: gcc-patches@gcc.gnu.org Subject: [PATCH v2 3/4] Rename loop_version to clone_loop_to_header_edge. Date: Wed, 27 Oct 2021 01:34:47 -0500 Message-Id: <20211027063448.1844771-4-luoxhu@linux.ibm.com> X-Mailer: git-send-email 2.27.0.90.geebb51ba8c In-Reply-To: <20211027063448.1844771-1-luoxhu@linux.ibm.com> References: <20211027063448.1844771-1-luoxhu@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: WQ1rXG6UCRMIQIj1byGO1mYqUfS-ZQJ5 X-Proofpoint-GUID: PPPQkx_0MU-IaiM1uH7va3j6dI4OJ3qH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-27_01,2021-10-26_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 phishscore=0 impostorscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 adultscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2110270038 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xionghu Luo via Gcc-patches From: Xionghu Luo Reply-To: Xionghu Luo Cc: rguenther@suse.de, segher@kernel.crashing.org, Xionghu Luo , hubicka@kam.mff.cuni.cz, wschmidt@linux.ibm.com, linkw@gcc.gnu.org, dje.gcc@gmail.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Name loop_copy is used in gcc/cfg.c already. gcc/ChangeLog: * cfgloopmanip.c (force_single_succ_latches): Rename loop_version to clone_loop_to_header_edge. (lv_adjust_loop_entry_edge): Likewise. (loop_version): Likewise. (clone_loop_to_header_edge): Likewise. * cfgloopmanip.h (class loop): Likewise. (clone_loop_to_header_edge): Likewise. * gimple-loop-versioning.cc (loop_versioning::version_loop): Likewise. * modulo-sched.c (sms_schedule): Likewise. * tree-if-conv.c (version_loop_for_if_conversion): Likewise. * tree-loop-distribution.c (version_loop_by_alias_check): Likewise. * tree-parloops.c (gen_parallel_loop): Likewise. * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Likewise. * tree-ssa-loop-split.c (split_loop): Likewise. (get_cond_branch_to_split_loop): Likewise. (do_split_loop_on_cond): Likewise. * tree-ssa-loop-unswitch.c (tree_unswitch_loop): Likewise. * tree-vect-loop-manip.c (vect_loop_versioning): Likewise. --- gcc/cfgloopmanip.c | 22 +++++++++++----------- gcc/cfgloopmanip.h | 8 ++++---- gcc/gimple-loop-versioning.cc | 11 ++++++----- gcc/modulo-sched.c | 6 +++--- gcc/tree-if-conv.c | 13 +++++++------ gcc/tree-loop-distribution.c | 4 ++-- gcc/tree-parloops.c | 10 +++++----- gcc/tree-ssa-loop-manip.c | 9 +++++---- gcc/tree-ssa-loop-split.c | 30 +++++++++++++++--------------- gcc/tree-ssa-loop-unswitch.c | 8 +++----- gcc/tree-vect-loop-manip.c | 5 +++-- 11 files changed, 64 insertions(+), 62 deletions(-) diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index a30ebe1cdb4..066fbddbcfe 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -1535,11 +1535,10 @@ force_single_succ_latches (void) loops_state_set (LOOPS_HAVE_SIMPLE_LATCHES); } -/* This function is called from loop_version. It splits the entry edge - of the loop we want to version, adds the versioning condition, and - adjust the edges to the two versions of the loop appropriately. - e is an incoming edge. Returns the basic block containing the - condition. +/* This function is called from clone_loop_to_header_edge. It splits the entry + edge of the loop we want to version, adds the versioning condition, and adjust + the edges to the two versions of the loop appropriately. e is an incoming + edge. Returns the basic block containing the condition. --- edge e ---- > [second_head] @@ -1588,7 +1587,7 @@ lv_adjust_loop_entry_edge (basic_block first_head, basic_block second_head, return new_head; } -/* Main entry point for Loop Versioning transformation. +/* Main entry point for Loop copy transformation. This transformation given a condition and a loop, creates -if (condition) { loop_copy1 } else { loop_copy2 }, @@ -1609,11 +1608,12 @@ lv_adjust_loop_entry_edge (basic_block first_head, basic_block second_head, instruction stream, otherwise it is placed before LOOP. */ class loop * -loop_version (class loop *loop, - void *cond_expr, basic_block *condition_bb, - profile_probability then_prob, profile_probability else_prob, - profile_probability then_scale, profile_probability else_scale, - bool place_after) +clone_loop_to_header_edge (class loop *loop, void *cond_expr, + basic_block *condition_bb, + profile_probability then_prob, + profile_probability else_prob, + profile_probability then_scale, + profile_probability else_scale, bool place_after) { basic_block first_head, second_head; edge entry, latch_edge; diff --git a/gcc/cfgloopmanip.h b/gcc/cfgloopmanip.h index 312a3b48d05..eac09518702 100644 --- a/gcc/cfgloopmanip.h +++ b/gcc/cfgloopmanip.h @@ -55,9 +55,9 @@ extern bool mfb_keep_just (edge); basic_block create_preheader (class loop *, int); extern void create_preheaders (int); extern void force_single_succ_latches (void); -class loop * loop_version (class loop *, void *, - basic_block *, - profile_probability, profile_probability, - profile_probability, profile_probability, bool); +class loop * +clone_loop_to_header_edge (class loop *, void *, basic_block *, + profile_probability, profile_probability, + profile_probability, profile_probability, bool); #endif /* GCC_CFGLOOPMANIP_H */ diff --git a/gcc/gimple-loop-versioning.cc b/gcc/gimple-loop-versioning.cc index 15e0803dc29..c0fa60b91f8 100644 --- a/gcc/gimple-loop-versioning.cc +++ b/gcc/gimple-loop-versioning.cc @@ -1686,11 +1686,12 @@ loop_versioning::version_loop (class loop *loop) /* Version the loop. */ initialize_original_copy_tables (); basic_block cond_bb; - li.optimized_loop = loop_version (loop, cond, &cond_bb, - profile_probability::unlikely (), - profile_probability::likely (), - profile_probability::unlikely (), - profile_probability::likely (), true); + li.optimized_loop + = clone_loop_to_header_edge (loop, cond, &cond_bb, + profile_probability::unlikely (), + profile_probability::likely (), + profile_probability::unlikely (), + profile_probability::likely (), true); free_original_copy_tables (); if (!li.optimized_loop) { diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c index 1c1b459d34f..26cd76a279c 100644 --- a/gcc/modulo-sched.c +++ b/gcc/modulo-sched.c @@ -1737,9 +1737,9 @@ sms_schedule (void) profile_probability prob = profile_probability::guessed_always () .apply_scale (PROB_SMS_ENOUGH_ITERATIONS, 100); - loop_version (loop, comp_rtx, &condition_bb, - prob, prob.invert (), - prob, prob.invert (), true); + clone_loop_to_header_edge (loop, comp_rtx, &condition_bb, prob, + prob.invert (), prob, prob.invert (), + true); } /* Now apply the scheduled kernel to the RTL of the loop. */ diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index d7b7b309309..893231a2d16 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -2871,7 +2871,8 @@ version_loop_for_if_conversion (class loop *loop, vec *preds) integer_zero_node); gimple_call_set_lhs (g, cond); - /* Save BB->aux around loop_version as that uses the same field. */ + /* Save BB->aux around clone_loop_to_header_edge as that uses the same field. + */ save_length = loop->inner ? loop->inner->num_nodes : loop->num_nodes; void **saved_preds = XALLOCAVEC (void *, save_length); for (unsigned i = 0; i < save_length; i++) @@ -2880,11 +2881,11 @@ version_loop_for_if_conversion (class loop *loop, vec *preds) initialize_original_copy_tables (); /* At this point we invalidate porfile confistency until IFN_LOOP_VECTORIZED is re-merged in the vectorizer. */ - new_loop = loop_version (loop, cond, &cond_bb, - profile_probability::always (), - profile_probability::always (), - profile_probability::always (), - profile_probability::always (), true); + new_loop = clone_loop_to_header_edge (loop, cond, &cond_bb, + profile_probability::always (), + profile_probability::always (), + profile_probability::always (), + profile_probability::always (), true); free_original_copy_tables (); for (unsigned i = 0; i < save_length; i++) diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 2df762c8aa8..ae543fa022d 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -2705,8 +2705,8 @@ version_loop_by_alias_check (vec *partitions, prob = profile_probability::guessed_always ().apply_scale (9, 10); initialize_original_copy_tables (); - nloop = loop_version (loop, lhs, &cond_bb, prob, prob.invert (), - prob, prob.invert (), true); + nloop = clone_loop_to_header_edge (loop, lhs, &cond_bb, prob, prob.invert (), + prob, prob.invert (), true); free_original_copy_tables (); /* Record the original loop number in newly generated loops. In case of distribution, the original loop will be distributed and the new loop diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 5e64d5ed7a3..e19fc52f38b 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -3083,11 +3083,11 @@ gen_parallel_loop (class loop *loop, initialize_original_copy_tables (); /* We assume that the loop usually iterates a lot. */ - loop_version (loop, many_iterations_cond, NULL, - profile_probability::likely (), - profile_probability::unlikely (), - profile_probability::likely (), - profile_probability::unlikely (), true); + clone_loop_to_header_edge (loop, many_iterations_cond, NULL, + profile_probability::likely (), + profile_probability::unlikely (), + profile_probability::likely (), + profile_probability::unlikely (), true); update_ssa (TODO_update_ssa); free_original_copy_tables (); } diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index c7a2f67b129..350e25bb8d2 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -1282,10 +1282,11 @@ tree_transform_and_unroll_loop (class loop *loop, unsigned factor, frequencies in its body because of this change (scale the frequencies of blocks before and after the exit by appropriate factors). */ profile_probability scale_unrolled = prob_entry; - new_loop = loop_version (loop, enter_main_cond, NULL, prob_entry, - prob_entry.invert (), scale_unrolled, - profile_probability::guessed_always (), - true); + new_loop + = clone_loop_to_header_edge (loop, enter_main_cond, NULL, prob_entry, + prob_entry.invert (), scale_unrolled, + profile_probability::guessed_always (), + true); gcc_assert (new_loop != NULL); update_ssa (TODO_update_ssa); diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c index d30782888f3..5bc9c0f6443 100644 --- a/gcc/tree-ssa-loop-split.c +++ b/gcc/tree-ssa-loop-split.c @@ -586,12 +586,12 @@ split_loop (class loop *loop1) initialize_original_copy_tables (); basic_block cond_bb; - class loop *loop2 = loop_version (loop1, cond, &cond_bb, - true_edge->probability, - true_edge->probability.invert (), - true_edge->probability, - true_edge->probability.invert (), - true); + class loop *loop2 + = clone_loop_to_header_edge (loop1, cond, &cond_bb, + true_edge->probability, + true_edge->probability.invert (), + true_edge->probability, + true_edge->probability.invert (), true); gcc_assert (loop2); edge new_e = connect_loops (loop1, loop2); @@ -1465,9 +1465,9 @@ get_cond_branch_to_split_loop (struct loop *loop, gcond *cond) exits In the graph, loop1 represents the part derived from original one, and - loop2 is duplicated using loop_version (), which corresponds to the part - of original one being splitted out. In original latch edge of loop1, we - insert a new conditional statement duplicated from the semi-invariant cond, + loop2 is duplicated using clone_loop_to_header_edge (), which corresponds to + the part of original one being splitted out. In original latch edge of loop1, + we insert a new conditional statement duplicated from the semi-invariant cond, and one of its branch goes back to loop1 header as a latch edge, and the other branch goes to loop2 pre-header as an entry edge. And also in loop2, we abandon the variant branch of the conditional statement by setting a @@ -1489,12 +1489,12 @@ do_split_loop_on_cond (struct loop *loop1, edge invar_branch) initialize_original_copy_tables (); - struct loop *loop2 = loop_version (loop1, boolean_true_node, NULL, - invar_branch->probability.invert (), - invar_branch->probability, - invar_branch->probability.invert (), - invar_branch->probability, - true); + struct loop *loop2 + = clone_loop_to_header_edge (loop1, boolean_true_node, NULL, + invar_branch->probability.invert (), + invar_branch->probability, + invar_branch->probability.invert (), + invar_branch->probability, true); if (!loop2) { free_original_copy_tables (); diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c index fe4dacc0833..6beebe368a7 100644 --- a/gcc/tree-ssa-loop-unswitch.c +++ b/gcc/tree-ssa-loop-unswitch.c @@ -488,11 +488,9 @@ tree_unswitch_loop (class loop *loop, extract_true_false_edges_from_block (unswitch_on, &edge_true, &edge_false); prob_true = edge_true->probability; - return loop_version (loop, unshare_expr (cond), - NULL, prob_true, - prob_true.invert (), - prob_true, prob_true.invert (), - false); + return clone_loop_to_header_edge (loop, unshare_expr (cond), NULL, prob_true, + prob_true.invert (), prob_true, + prob_true.invert (), false); } /* Unswitch outer loops by hoisting invariant guard on diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index 4988c93fdb6..ebc013f195e 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -3558,8 +3558,9 @@ vect_loop_versioning (loop_vec_info loop_vinfo, loop_to_version->num); initialize_original_copy_tables (); - nloop = loop_version (loop_to_version, cond_expr, &condition_bb, - prob, prob.invert (), prob, prob.invert (), true); + nloop = clone_loop_to_header_edge (loop_to_version, cond_expr, + &condition_bb, prob, prob.invert (), + prob, prob.invert (), true); gcc_assert (nloop); nloop = get_loop_copy (loop); From patchwork Wed Oct 27 06:34:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xionghu Luo X-Patchwork-Id: 46693 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5663C3857422 for ; Wed, 27 Oct 2021 06:40:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5663C3857422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635316834; bh=30eklrnkBAp7TkQdNJaFtwLQ5k/JWSz1JPTlQR0qiZA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=VREQi15VM2VKYU8jmkeULsKqYNBtknMZhbp1pr0ApMVC9wa/mNgD0LEYT/ibNxP/g +5ExC3gA8qvJMbCXrR4ofsZ2jMEp4QZxG8T8ZM5o9A4lysMG9cdU979SaZt+zpoQrn aXZWqSKs98xwsM2z9XBp+/k+xHY1K2uEjulufvpE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 53630385702C; Wed, 27 Oct 2021 06:36:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 53630385702C Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19R5Mk1A034870; Wed, 27 Oct 2021 06:36:06 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3by0jrsget-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 06:36:06 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19R6a58n019120; Wed, 27 Oct 2021 06:36:05 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 3by0jrsgdw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 06:36:05 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 19R6SP1x014247; Wed, 27 Oct 2021 06:36:03 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03fra.de.ibm.com with ESMTP id 3bx4epu6nd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 06:36:02 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19R6Trbc61669800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Oct 2021 06:29:53 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 697044C052; Wed, 27 Oct 2021 06:35:59 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F39304C044; Wed, 27 Oct 2021 06:35:57 +0000 (GMT) Received: from marlin.aus.stglabs.ibm.com (unknown [9.40.194.84]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 27 Oct 2021 06:35:57 +0000 (GMT) To: gcc-patches@gcc.gnu.org Subject: [PATCH v2 4/4] Rename duplicate_loop_to_header_edge to duplicate_loop_body_to_header_edge Date: Wed, 27 Oct 2021 01:34:48 -0500 Message-Id: <20211027063448.1844771-5-luoxhu@linux.ibm.com> X-Mailer: git-send-email 2.27.0.90.geebb51ba8c In-Reply-To: <20211027063448.1844771-1-luoxhu@linux.ibm.com> References: <20211027063448.1844771-1-luoxhu@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: o047_smofh6fl8Tf3PkLMJ_JcpFDbd3v X-Proofpoint-ORIG-GUID: 7pfQt-ZzEvQDmRhurR2cOMQxoK_Yqu_N X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-27_02,2021-10-26_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 suspectscore=0 spamscore=0 clxscore=1015 adultscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=954 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2110270038 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xionghu Luo via Gcc-patches From: Xionghu Luo Reply-To: Xionghu Luo Cc: rguenther@suse.de, segher@kernel.crashing.org, Xionghu Luo , hubicka@kam.mff.cuni.cz, wschmidt@linux.ibm.com, linkw@gcc.gnu.org, dje.gcc@gmail.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" gcc/ChangeLog: * cfghooks.c (cfg_hook_duplicate_loop_to_header_edge): Rename duplicate_loop_to_header_edge to duplicate_loop_body_to_header_edge. (cfg_hook_duplicate_loop_body_to_header_edge): Likewise. * cfghooks.h (struct cfg_hooks): Likewise. (cfg_hook_duplicate_loop_body_to_header_edge): Likewise. * cfgloopmanip.c (duplicate_loop_body_to_header_edge): Likewise. (clone_loop_to_header_edge): Likewise. * cfgloopmanip.h (duplicate_loop_body_to_header_edge): Likewise. * cfgrtl.c (struct cfg_hooks): Likewise. * doc/loop.texi: Likewise. * loop-unroll.c (unroll_loop_constant_iterations): Likewise. (unroll_loop_runtime_iterations): Likewise. (unroll_loop_stupid): Likewise. (apply_opt_in_copies): Likewise. * tree-cfg.c (struct cfg_hooks): Likewise. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise. (try_peel_loop): Likewise. * tree-ssa-loop-manip.c (copy_phi_node_args): Likewise. (gimple_duplicate_loop_body_to_header_edge): Likewise. (tree_transform_and_unroll_loop): Likewise. * tree-ssa-loop-manip.h (gimple_duplicate_loop_body_to_header_edge): Likewise. --- gcc/cfghooks.c | 27 ++++++++++++--------------- gcc/cfghooks.h | 13 ++++++------- gcc/cfgloopmanip.c | 9 ++++----- gcc/cfgloopmanip.h | 6 +++--- gcc/cfgrtl.c | 2 +- gcc/doc/loop.texi | 4 ++-- gcc/loop-unroll.c | 27 ++++++++++++--------------- gcc/tree-cfg.c | 2 +- gcc/tree-ssa-loop-ivcanon.c | 4 ++-- gcc/tree-ssa-loop-manip.c | 22 ++++++++++++---------- gcc/tree-ssa-loop-manip.h | 7 +++---- 11 files changed, 58 insertions(+), 65 deletions(-) diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index 50b9b177639..23eb364bee6 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -1226,25 +1226,22 @@ lv_flush_pending_stmts (edge e) cfg_hooks->flush_pending_stmts (e); } -/* Loop versioning uses the duplicate_loop_to_header_edge to create +/* Loop versioning uses the duplicate_loop_body_to_header_edge to create a new version of the loop basic-blocks, the parameters here are - exactly the same as in duplicate_loop_to_header_edge or - tree_duplicate_loop_to_header_edge; while in tree-ssa there is + exactly the same as in duplicate_loop_body_to_header_edge or + tree_duplicate_loop_body_to_header_edge; while in tree-ssa there is additional work to maintain ssa information that's why there is - a need to call the tree_duplicate_loop_to_header_edge rather - than duplicate_loop_to_header_edge when we are in tree mode. */ + a need to call the tree_duplicate_loop_body_to_header_edge rather + than duplicate_loop_body_to_header_edge when we are in tree mode. */ bool -cfg_hook_duplicate_loop_to_header_edge (class loop *loop, edge e, - unsigned int ndupl, - sbitmap wont_exit, edge orig, - vec *to_remove, - int flags) +cfg_hook_duplicate_loop_body_to_header_edge (class loop *loop, edge e, + unsigned int ndupl, + sbitmap wont_exit, edge orig, + vec *to_remove, int flags) { - gcc_assert (cfg_hooks->cfg_hook_duplicate_loop_to_header_edge); - return cfg_hooks->cfg_hook_duplicate_loop_to_header_edge (loop, e, - ndupl, wont_exit, - orig, to_remove, - flags); + gcc_assert (cfg_hooks->cfg_hook_duplicate_loop_body_to_header_edge); + return cfg_hooks->cfg_hook_duplicate_loop_body_to_header_edge ( + loop, e, ndupl, wont_exit, orig, to_remove, flags); } /* Conditional jumps are represented differently in trees and RTL, diff --git a/gcc/cfghooks.h b/gcc/cfghooks.h index 8645fe5b9e7..29aa2bf0636 100644 --- a/gcc/cfghooks.h +++ b/gcc/cfghooks.h @@ -166,7 +166,7 @@ struct cfg_hooks /* A hook for duplicating loop in CFG, currently this is used in loop versioning. */ - bool (*cfg_hook_duplicate_loop_to_header_edge) (class loop *, edge, + bool (*cfg_hook_duplicate_loop_body_to_header_edge) (class loop *, edge, unsigned, sbitmap, edge, vec *, int); @@ -250,12 +250,11 @@ extern bool block_ends_with_condjump_p (const_basic_block bb); extern int flow_call_edges_add (sbitmap); extern void execute_on_growing_pred (edge); extern void execute_on_shrinking_pred (edge); -extern bool cfg_hook_duplicate_loop_to_header_edge (class loop *loop, edge, - unsigned int ndupl, - sbitmap wont_exit, - edge orig, - vec *to_remove, - int flags); +extern bool +cfg_hook_duplicate_loop_body_to_header_edge (class loop *loop, edge, + unsigned int ndupl, + sbitmap wont_exit, edge orig, + vec *to_remove, int flags); extern void lv_flush_pending_stmts (edge); extern void extract_cond_bb_edges (basic_block, edge *, edge*); diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index 066fbddbcfe..455c3ef8db9 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -1059,10 +1059,9 @@ can_duplicate_loop_p (const class loop *loop) impossible. */ bool -duplicate_loop_to_header_edge (class loop *loop, edge e, - unsigned int ndupl, sbitmap wont_exit, - edge orig, vec *to_remove, - int flags) +duplicate_loop_body_to_header_edge (class loop *loop, edge e, + unsigned int ndupl, sbitmap wont_exit, + edge orig, vec *to_remove, int flags) { class loop *target, *aloop; class loop **orig_loops; @@ -1630,7 +1629,7 @@ clone_loop_to_header_edge (class loop *loop, void *cond_expr, first_head = entry->dest; /* 1) Duplicate loop on the entry edge. */ - if (!cfg_hook_duplicate_loop_to_header_edge (loop, entry, 1, + if (!cfg_hook_duplicate_loop_body_to_header_edge (loop, entry, 1, NULL, NULL, NULL, 0)) { entry->flags |= irred_flag; diff --git a/gcc/cfgloopmanip.h b/gcc/cfgloopmanip.h index eac09518702..42ba0689825 100644 --- a/gcc/cfgloopmanip.h +++ b/gcc/cfgloopmanip.h @@ -48,9 +48,9 @@ extern class loop * duplicate_loop (class loop *, class loop *, class loop * = NULL); extern void duplicate_subloops (class loop *, class loop *); extern bool can_duplicate_loop_p (const class loop *loop); -extern bool duplicate_loop_to_header_edge (class loop *, edge, - unsigned, sbitmap, edge, - vec *, int); +extern bool +duplicate_loop_body_to_header_edge (class loop *, edge, unsigned, sbitmap, edge, + vec *, int); extern bool mfb_keep_just (edge); basic_block create_preheader (class loop *, int); extern void create_preheaders (int); diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 4f3b1e8f3dc..e3a724bddb4 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -5344,7 +5344,7 @@ struct cfg_hooks cfg_layout_rtl_cfg_hooks = { rtl_flow_call_edges_add, NULL, /* execute_on_growing_pred */ NULL, /* execute_on_shrinking_pred */ - duplicate_loop_to_header_edge, /* duplicate loop for trees */ + duplicate_loop_body_to_header_edge, /* duplicate loop for trees */ rtl_lv_add_condition_to_bb, /* lv_add_condition_to_bb */ NULL, /* lv_adjust_loop_header_phi*/ rtl_extract_cond_bb_edges, /* extract_cond_bb_edges */ diff --git a/gcc/doc/loop.texi b/gcc/doc/loop.texi index 94eed6720b1..29a580066d6 100644 --- a/gcc/doc/loop.texi +++ b/gcc/doc/loop.texi @@ -249,8 +249,8 @@ are only reliable for the innermost loops: @item @code{create_iv}: Creates a new induction variable. Only works on GIMPLE@. @code{standard_iv_increment_position} can be used to find a suitable place for the iv increment. -@item @code{duplicate_loop_to_header_edge}, -@code{tree_duplicate_loop_to_header_edge}: These functions (on RTL and +@item @code{duplicate_loop_body_to_header_edge}, +@code{tree_duplicate_loop_body_to_header_edge}: These functions (on RTL and on GIMPLE) duplicate the body of the loop prescribed number of times on one of the edges entering loop header, thus performing either loop unrolling or loop peeling. @code{can_duplicate_loop_p} diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 2b31fafa3a3..f554ebb8450 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -520,14 +520,11 @@ unroll_loop_constant_iterations (class loop *loop) if (exit_mod) { opt_info_start_duplication (opt_info); - ok = duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop), - exit_mod, - wont_exit, desc->out_edge, - &remove_edges, - DLTHE_FLAG_UPDATE_FREQ - | (opt_info && exit_mod > 1 - ? DLTHE_RECORD_COPY_NUMBER - : 0)); + ok = duplicate_loop_body_to_header_edge ( + loop, loop_preheader_edge (loop), exit_mod, wont_exit, + desc->out_edge, &remove_edges, + DLTHE_FLAG_UPDATE_FREQ + | (opt_info && exit_mod > 1 ? DLTHE_RECORD_COPY_NUMBER : 0)); gcc_assert (ok); if (opt_info && exit_mod > 1) @@ -569,7 +566,7 @@ unroll_loop_constant_iterations (class loop *loop) bitmap_clear_bit (wont_exit, 1); opt_info_start_duplication (opt_info); - ok = duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop), + ok = duplicate_loop_body_to_header_edge (loop, loop_preheader_edge (loop), exit_mod + 1, wont_exit, desc->out_edge, &remove_edges, @@ -606,7 +603,7 @@ unroll_loop_constant_iterations (class loop *loop) /* Now unroll the loop. */ opt_info_start_duplication (opt_info); - ok = duplicate_loop_to_header_edge (loop, loop_latch_edge (loop), + ok = duplicate_loop_body_to_header_edge (loop, loop_latch_edge (loop), max_unroll, wont_exit, desc->out_edge, &remove_edges, @@ -975,7 +972,7 @@ unroll_loop_runtime_iterations (class loop *loop) if (!desc->noloop_assumptions) bitmap_set_bit (wont_exit, 1); ezc_swtch = loop_preheader_edge (loop)->src; - ok = duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop), + ok = duplicate_loop_body_to_header_edge (loop, loop_preheader_edge (loop), 1, wont_exit, desc->out_edge, &remove_edges, DLTHE_FLAG_UPDATE_FREQ); @@ -997,7 +994,7 @@ unroll_loop_runtime_iterations (class loop *loop) bitmap_clear (wont_exit); if (i != n_peel - 1 || !last_may_exit) bitmap_set_bit (wont_exit, 1); - ok = duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop), + ok = duplicate_loop_body_to_header_edge (loop, loop_preheader_edge (loop), 1, wont_exit, desc->out_edge, &remove_edges, DLTHE_FLAG_UPDATE_FREQ); @@ -1061,7 +1058,7 @@ unroll_loop_runtime_iterations (class loop *loop) bitmap_clear_bit (wont_exit, may_exit_copy); opt_info_start_duplication (opt_info); - ok = duplicate_loop_to_header_edge (loop, loop_latch_edge (loop), + ok = duplicate_loop_body_to_header_edge (loop, loop_latch_edge (loop), max_unroll, wont_exit, desc->out_edge, &remove_edges, @@ -1255,7 +1252,7 @@ unroll_loop_stupid (class loop *loop) bitmap_clear (wont_exit); opt_info_start_duplication (opt_info); - ok = duplicate_loop_to_header_edge (loop, loop_latch_edge (loop), + ok = duplicate_loop_body_to_header_edge (loop, loop_latch_edge (loop), nunroll, wont_exit, NULL, NULL, DLTHE_FLAG_UPDATE_FREQ @@ -2019,7 +2016,7 @@ apply_opt_in_copies (struct opt_info *opt_info, orig_bb = get_bb_original (bb); /* bb->aux holds position in copy sequence initialized by - duplicate_loop_to_header_edge. */ + duplicate_loop_body_to_header_edge. */ delta = determine_split_iv_delta ((size_t)bb->aux, n_copies, unrolling); bb->aux = 0; diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 9883eaaa9bf..d0177cb1c07 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -9072,7 +9072,7 @@ struct cfg_hooks gimple_cfg_hooks = { gimple_flow_call_edges_add, /* flow_call_edges_add */ gimple_execute_on_growing_pred, /* execute_on_growing_pred */ gimple_execute_on_shrinking_pred, /* execute_on_shrinking_pred */ - gimple_duplicate_loop_to_header_edge, /* duplicate loop for trees */ + gimple_duplicate_loop_body_to_header_edge, /* duplicate loop for trees */ gimple_lv_add_condition_to_bb, /* lv_add_condition_to_bb */ gimple_lv_adjust_loop_header_phi, /* lv_adjust_loop_header_phi*/ extract_true_false_edges_from_block, /* extract_cond_bb_edges */ diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index 8d8791f837e..a9107ef5ffb 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -903,7 +903,7 @@ try_unroll_loop_completely (class loop *loop, if (may_be_zero) bitmap_clear_bit (wont_exit, 1); - if (!gimple_duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop), + if (!gimple_duplicate_loop_body_to_header_edge (loop, loop_preheader_edge (loop), n_unroll, wont_exit, exit, &edges_to_remove, DLTHE_FLAG_UPDATE_FREQ @@ -1094,7 +1094,7 @@ try_peel_loop (class loop *loop, } if (may_be_zero) bitmap_clear_bit (wont_exit, 1); - if (!gimple_duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop), + if (!gimple_duplicate_loop_body_to_header_edge (loop, loop_preheader_edge (loop), npeel, wont_exit, exit, &edges_to_remove, DLTHE_FLAG_UPDATE_FREQ)) diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index 350e25bb8d2..b60da4fb084 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -911,7 +911,7 @@ copy_phi_node_args (unsigned first_new_block) } -/* The same as cfgloopmanip.c:duplicate_loop_to_header_edge, but also +/* The same as cfgloopmanip.c:duplicate_loop_body_to_header_edge, but also updates the PHI nodes at start of the copied region. In order to achieve this, only loops whose exits all lead to the same location are handled. @@ -921,10 +921,10 @@ copy_phi_node_args (unsigned first_new_block) after the loop has been duplicated. */ bool -gimple_duplicate_loop_to_header_edge (class loop *loop, edge e, - unsigned int ndupl, sbitmap wont_exit, - edge orig, vec *to_remove, - int flags) +gimple_duplicate_loop_body_to_header_edge (class loop *loop, edge e, + unsigned int ndupl, + sbitmap wont_exit, edge orig, + vec *to_remove, int flags) { unsigned first_new_block; @@ -934,8 +934,8 @@ gimple_duplicate_loop_to_header_edge (class loop *loop, edge e, return false; first_new_block = last_basic_block_for_fn (cfun); - if (!duplicate_loop_to_header_edge (loop, e, ndupl, wont_exit, - orig, to_remove, flags)) + if (!duplicate_loop_body_to_header_edge (loop, e, ndupl, wont_exit, orig, + to_remove, flags)) return false; /* Readd the removed phi args for e. */ @@ -1390,9 +1390,11 @@ tree_transform_and_unroll_loop (class loop *loop, unsigned factor, bitmap_clear_bit (wont_exit, factor - 1); auto_vec to_remove; - bool ok = gimple_duplicate_loop_to_header_edge - (loop, loop_latch_edge (loop), factor - 1, - wont_exit, new_exit, &to_remove, DLTHE_FLAG_UPDATE_FREQ); + bool ok + = gimple_duplicate_loop_body_to_header_edge (loop, loop_latch_edge (loop), + factor - 1, wont_exit, + new_exit, &to_remove, + DLTHE_FLAG_UPDATE_FREQ); gcc_assert (ok); for (edge e : to_remove) diff --git a/gcc/tree-ssa-loop-manip.h b/gcc/tree-ssa-loop-manip.h index 86fc118b6be..792c366701b 100644 --- a/gcc/tree-ssa-loop-manip.h +++ b/gcc/tree-ssa-loop-manip.h @@ -42,10 +42,9 @@ extern basic_block ip_end_pos (class loop *); extern basic_block ip_normal_pos (class loop *); extern void standard_iv_increment_position (class loop *, gimple_stmt_iterator *, bool *); -extern bool gimple_duplicate_loop_to_header_edge (class loop *, edge, - unsigned int, sbitmap, - edge, vec *, - int); +extern bool +gimple_duplicate_loop_body_to_header_edge (class loop *, edge, unsigned int, + sbitmap, edge, vec *, int); extern bool can_unroll_loop_p (class loop *loop, unsigned factor, class tree_niter_desc *niter); extern gcov_type niter_for_unrolled_loop (class loop *, unsigned);