From patchwork Tue Nov 12 14:11:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 1193554 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=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513127-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="u6wTNlXy"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47C8n166Whz9sP3 for ; Wed, 13 Nov 2019 01:11:31 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:mime-version:content-transfer-encoding :message-id; q=dns; s=default; b=rNggajfbTL/c8GR46SKSZ6mexCa+czK GLWKE43iGt56+b/vebiG84emV373COkgnWPBlezaCeim58NuI8gbueXR1sn52Pqj Un6+EYKav4g2cHNdw8pyTmMGhSLauzewTO0jrbrBmyt70pKzbNt9zpHhxXESRFTM rvCqBIk5XMqQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:mime-version:content-transfer-encoding :message-id; s=default; bh=hdEYjdirscSOAMgMpGhKe4GY0Es=; b=u6wTN lXyvIdKVHpsiHoY5LV0I4N9rJeHkeVS2GjPVutGSisLudfvDsdeZHqYl8L2ZVOyZ ccK7rDT8V/96xSTsH31PotBa4E38EVi/ujg1tM5UXrvsfHHQdCa8H05NSynfGKkm xNa/O3SVIL2Ync/VJodSSR6fKJQA3M3dOL7pts= Received: (qmail 50580 invoked by alias); 12 Nov 2019 14:11:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 50568 invoked by uid 89); 12 Nov 2019 14:11:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=1, 25 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Nov 2019 14:11:18 +0000 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xACE4h9U124206 for ; Tue, 12 Nov 2019 09:11:16 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w7w1p3k09-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 12 Nov 2019 09:11:16 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 12 Nov 2019 14:11:14 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 12 Nov 2019 14:11:12 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xACEBA1X31195276 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Nov 2019 14:11:10 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 771ECA4051; Tue, 12 Nov 2019 14:11:10 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3E853A4055; Tue, 12 Nov 2019 14:11:10 +0000 (GMT) Received: from white.boeblingen.de.ibm.com (unknown [9.152.99.134]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 12 Nov 2019 14:11:10 +0000 (GMT) From: Ilya Leoshkevich To: gcc-patches@gcc.gnu.org, rguenther@suse.de, law@redhat.com, segher@gcc.gnu.org Cc: krebbel@linux.ibm.com, Ilya Leoshkevich Subject: [PATCH] Free dominance info at the beginning of pass_jump_after_combine Date: Tue, 12 Nov 2019 15:11:05 +0100 MIME-Version: 1.0 x-cbid: 19111214-0016-0000-0000-000002C30170 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19111214-0017-0000-0000-00003324977D Message-Id: <20191112141105.36592-1-iii@linux.ibm.com> X-IsSubscribed: yes Bootstrapped and regtested on x86_64-redhat-linux, s390x-redhat-linux and ppc64le-redhat-linux. OK for trunk and gcc-9-branch? try_forward_edges does not update dominance info, and merge_blocks relies on it being up-to-date. In PR92430 stale dominance info makes merge_blocks produce a loop in the dominator tree, which in turn makes delete_basic_block loop forever. Fix by freeing dominance info at the beginning of cleanup_cfg. gcc/ChangeLog: 2019-11-12 Ilya Leoshkevich PR rtl-optimization/92430 * cfgcleanup.c (pass_jump_after_combine::execute): Free dominance info at the beginning. gcc/testsuite/ChangeLog: 2019-11-12 Ilya Leoshkevich PR rtl-optimization/92430 * gcc.dg/pr92430.c: New test (from Arseny Solokha). --- gcc/cfgcleanup.c | 3 +++ gcc/testsuite/gcc.dg/pr92430.c | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr92430.c diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 835f7d79ea4..20096de88b4 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -3312,6 +3312,9 @@ public: unsigned int pass_jump_after_combine::execute (function *) { + /* Jump threading does not keep dominators up-to-date. */ + free_dominance_info (CDI_DOMINATORS); + free_dominance_info (CDI_POST_DOMINATORS); cleanup_cfg (flag_thread_jumps ? CLEANUP_THREADING : 0); return 0; } diff --git a/gcc/testsuite/gcc.dg/pr92430.c b/gcc/testsuite/gcc.dg/pr92430.c new file mode 100644 index 00000000000..915606893ba --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr92430.c @@ -0,0 +1,25 @@ +// PR rtl-optimization/92430 +// { dg-do compile } +// { dg-options "-Os -fno-if-conversion -fno-tree-dce -fno-tree-loop-optimize -fno-tree-vrp" } + +int eb, ko; + +void +e9 (int pe, int lx) +{ + int ir; + + for (ir = 0; ir < 1; ++ir) + { + for (ko = 0; ko < 1; ++ko) + { + for (eb = 0; eb < 1; ++eb) + ko += pe; + + for (ko = 0; ko < 1; ++ko) + ; + } + + pe = ir = lx; + } +}