From patchwork Wed Oct 23 21:44:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Kulkarni X-Patchwork-Id: 177359 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp1319069ill; Wed, 23 Oct 2019 14:45:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSjx0T2X+W8AW7Z3V0XHmMm5RAWEXEiDUqgK1WUxhMJCISigMw987E5jCzgg05/pVmzKu4 X-Received: by 2002:a17:907:429e:: with SMTP id ny22mr9177364ejb.174.1571867146420; Wed, 23 Oct 2019 14:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571867146; cv=none; d=google.com; s=arc-20160816; b=ZZtafjagR/TWI2pYLSLKLutHH56is/UNWKfg3g7R6tYLkedVNw3vKeUiJtHrnyyPQo 30WZ6nSlXlkBB7G+JK0liv6ylE3DZ+Ls+/qcYeSydfYAukApTXxsMAV2XHgXbDVvEg5W FBvxZfPHB/5Bvq0QbnxSmzq106qxv3q8lcuin3hOqwmkld4cxWuB6z/MQbP4hZFHm3jH m5dzdTJCCUg1iwHza4DsVLHFVkyuiapI0+PhW6/1fxiQZHCA+aNQNyRgvn3fvAFNlbEv vZScKkiO13RmVzIxdKj6IjHXR0cHziqhGF+zk+FT/wuQs3zSF0J3vSqHliORVRg0922R 9TJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:mime-version:dkim-signature :delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature; bh=6owunyUMXhvIAQcQQkEzTIjU3c/ktfv6nW5pRm7e5Xo=; b=yiqlXvpjZKyrCHVN3uuBLl2QrFp7lArsfFkG6fDda058t+XEpXOANzBUc3giO3PB+j Mu21O70ZiGEwCypX2TNh/RWubRufYVU6m2s9zh+4b37MOrHPEFGqAe1lQTJrMDt+PomK 7LXkSJFiHwW3WFTEwZcv1CpyZWaMYkrTFAIV9LjKzL3y0btNmS3Tjq0r5KO2larydhyU ZsgOSJJYSDHZSYo2Coen4pRbzVsoDAXyU3NBzG9CpgIKq9j8kw+T+2h/0wSrLQhZgeP5 +RNINBPxoiem1q6cDUZWhrtwJ4aejqCfKsjU/wCG/9OJj2qXdb4StLl75atzAajch8on KKUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=GN1PFtcR; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DZABeRWo; spf=pass (google.com: domain of gcc-patches-return-511632-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-511632-patch=linaro.org@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id t21si2567750ejs.108.2019.10.23.14.45.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Oct 2019 14:45:46 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-511632-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=GN1PFtcR; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DZABeRWo; spf=pass (google.com: domain of gcc-patches-return-511632-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-511632-patch=linaro.org@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=vwatAths2g3/hiTSNixh712hhV5dj9gxjA/FIB4ZrFDwOz lhGnjsJeXkFtKt7Pb2jLE2sFYY6hIR6cMeU/2Sum281ydmCe/eghoyIiatdA8M6k itowa0c6wUZcn86WMe/rW6pjWnrd5CoOkvRZ3fVhFFsU+/mi20twokY6FjZV0= 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 :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=bcsueQXb+vDDbzlxwPymHt1YhgU=; b=GN1PFtcRBUniUapIC7Gq kBQCv/IOfPEhFRs3sjKlyUztKXRMPfVU+um3DxAm9bJrgW91kUoupQHlLP73vTBJ 1PN8vjHJABuPsVocTP73bwXnu+jSB+YDiUpVQgDj0O4OUUGcqgRE1e55AMreoU5q 41djZZboO8Wh7BuxD7fy/NE= Received: (qmail 119817 invoked by alias); 23 Oct 2019 21:45:33 -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 119442 invoked by uid 89); 23 Oct 2019 21:45:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=20191024, 2019-10-24, treessadsec, UD:tree-ssa-dse.c X-HELO: mail-lj1-f179.google.com Received: from mail-lj1-f179.google.com (HELO mail-lj1-f179.google.com) (209.85.208.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Oct 2019 21:45:27 +0000 Received: by mail-lj1-f179.google.com with SMTP id u22so4707487lji.7 for ; Wed, 23 Oct 2019 14:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:from:date:message-id:subject:to; bh=R60D9z+ufZP6EATsMxVt7RUEyiOsYkYOkQrkE/KukEY=; b=DZABeRWotz//3VMoW8UGoWqmJbU3BZWbBMLUSxLSN/8kBKHDs+7lNa5LnkXHDNhA6j 4P/q/lpbAQtUbJ67vZN9EVb0W/+TqVthhjvwC6UUzHJiZ/YXDOjaMu/tcjWkjGWm62Zx 51X3GCLihOdWBBAkDptoiU+5uFSbXmBYkzB8DfCJBo13LhJLyfgkwpNcDlrVt9carj9M 9UIBygIX7UDoZ7IQ7izjFTFAfpgECthDem5FOP1phPTpcfOaZUb+hOHYTPvXLke42eME hA3nKG0UsXUJeM8LsHpqZp7qE9z4O7W/E2glVLhplxvabecyHGDj2GNGYm85teke9rTf EAaQ== MIME-Version: 1.0 From: Prathamesh Kulkarni Date: Wed, 23 Oct 2019 14:44:38 -0700 Message-ID: Subject: PR92163 To: gcc Patches , Jakub Jelinek X-IsSubscribed: yes Hi, The attached patch tries to fix PR92163 by calling gimple_purge_dead_eh_edges from ifcvt_local_dce if we need eh cleanup. Does it look OK ? Thanks, Prathamesh 2019-10-24 Prathamesh Kulkarni PR tree-optimization/92163 * tree-if-conv.c (ifcvt_local_dce): Call gimple_purge_dead_eh_edges if eh cleanup is required. * tree-ssa-dse.c (delete_dead_or_redundant_assignment): Change return type to bool and return the return value of gsi_remove. * tree-ssa-dse.h (delete_dead_or_redundant_assignment): Adjust prototype. testsuite/ * gcc.dg/tree-ssa/pr92163.c: New test. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr92163.c b/gcc/testsuite/gcc.dg/tree-ssa/pr92163.c new file mode 100644 index 00000000000..f64eaea6517 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr92163.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fexceptions -fnon-call-exceptions -fopenacc" } */ + +void +xr (int *k7) +{ + int qa; + +#pragma acc parallel +#pragma acc loop vector + for (qa = 0; qa < 3; ++qa) + if (qa % 2 != 0) + k7[qa] = 0; + else + k7[qa] = 1; +} diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index df9046a3014..3e2769dd02d 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -2963,6 +2963,7 @@ ifcvt_local_dce (class loop *loop) } } /* Delete dead statements. */ + bool do_eh_cleanup = false; gsi = gsi_start_bb (bb); while (!gsi_end_p (gsi)) { @@ -2975,7 +2976,7 @@ ifcvt_local_dce (class loop *loop) if (dse_classify_store (&write, stmt, false, NULL, NULL, latch_vdef) == DSE_STORE_DEAD) - delete_dead_or_redundant_assignment (&gsi, "dead"); + do_eh_cleanup |= delete_dead_or_redundant_assignment (&gsi, "dead"); else gsi_next (&gsi); continue; @@ -2994,6 +2995,9 @@ ifcvt_local_dce (class loop *loop) gsi_remove (&gsi, true); release_defs (stmt); } + + if (do_eh_cleanup) + gimple_purge_dead_eh_edges (bb); } /* If-convert LOOP when it is legal. For the moment this pass has no diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index 25cd4709b31..deec6c07c50 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -77,7 +77,6 @@ along with GCC; see the file COPYING3. If not see fact, they are the same transformation applied to different views of the CFG. */ -void delete_dead_or_redundant_assignment (gimple_stmt_iterator *, const char *); static void delete_dead_or_redundant_call (gimple_stmt_iterator *, const char *); /* Bitmap of blocks that have had EH statements cleaned. We should @@ -899,7 +898,7 @@ delete_dead_or_redundant_call (gimple_stmt_iterator *gsi, const char *type) /* Delete a dead store at GSI, which is a gimple assignment. */ -void +bool delete_dead_or_redundant_assignment (gimple_stmt_iterator *gsi, const char *type) { gimple *stmt = gsi_stmt (*gsi); @@ -915,12 +914,14 @@ delete_dead_or_redundant_assignment (gimple_stmt_iterator *gsi, const char *type /* Remove the dead store. */ basic_block bb = gimple_bb (stmt); - if (gsi_remove (gsi, true)) + bool eh_cleanup_required = gsi_remove (gsi, true); + if (eh_cleanup_required && need_eh_cleanup) bitmap_set_bit (need_eh_cleanup, bb->index); /* And release any SSA_NAMEs set in this statement back to the SSA_NAME manager. */ release_defs (stmt); + return eh_cleanup_required; } /* Attempt to eliminate dead stores in the statement referenced by BSI. diff --git a/gcc/tree-ssa-dse.h b/gcc/tree-ssa-dse.h index a5eccbd746d..80b6d9b2616 100644 --- a/gcc/tree-ssa-dse.h +++ b/gcc/tree-ssa-dse.h @@ -31,6 +31,6 @@ enum dse_store_status dse_store_status dse_classify_store (ao_ref *, gimple *, bool, sbitmap, bool * = NULL, tree = NULL); -void delete_dead_or_redundant_assignment (gimple_stmt_iterator *, const char *); +bool delete_dead_or_redundant_assignment (gimple_stmt_iterator *, const char *); #endif /* GCC_TREE_SSA_DSE_H */