From patchwork Wed May 6 10:38:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1284290 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49HCjk2F8kz9sRY for ; Wed, 6 May 2020 20:38:18 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 673C83898536; Wed, 6 May 2020 10:38:16 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 5ECB7389367C for ; Wed, 6 May 2020 10:38:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5ECB7389367C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rguenther@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1874BAE72 for ; Wed, 6 May 2020 10:38:15 +0000 (UTC) Date: Wed, 6 May 2020 12:38:12 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] middle-end/94964 - avoid EH loop entry with CP_SIMPLE_PREHEADERS Message-ID: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 X-Spam-Status: No, score=-18.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Loop optimizers expect to be able to insert on the preheader edge w/o splitting it thus avoid ending up with a preheader that enters the loop via an EH edge (or an abnormal edge). Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2020-05-06 Richard Biener PR middle-end/94964 * cfgloopmanip.c (create_preheader): Require non-complex preheader edge for CP_SIMPLE_PREHEADERS. --- gcc/cfgloopmanip.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index 50c7267ec49..73134a20e33 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -1506,9 +1506,10 @@ create_preheader (class loop *loop, int flags) else { /* If we want simple preheaders, also force the preheader to have - just a single successor. */ + just a single successor and a normal edge. */ if ((flags & CP_SIMPLE_PREHEADERS) - && !single_succ_p (single_entry->src)) + && ((single_entry->flags & EDGE_COMPLEX) + || !single_succ_p (single_entry->src))) need_forwarder_block = true; /* If we want fallthru preheaders, also create forwarder block when preheader ends with a jump or has predecessors from loop. */