From patchwork Thu Sep 10 11:01:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 1361498 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 4BnGD71RHdz9sSJ for ; Thu, 10 Sep 2020 21:01:41 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 11C2D3971C6F; Thu, 10 Sep 2020 11:01:38 +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 2019A3971C08 for ; Thu, 10 Sep 2020 11:01:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2019A3971C08 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CDE32B2CE for ; Thu, 10 Sep 2020 11:01:50 +0000 (UTC) Date: Thu, 10 Sep 2020 13:01:33 +0200 From: Tom de Vries To: gcc-patches@gcc.gnu.org Subject: [committed][tree-optimization] Don't clear ctrl-altering flag for IFN_UNIQUE Message-ID: <20200910110132.GA3285@delia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-10.9 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: , Cc: Richard Biener Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, There's an invariant for IFN_UNIQUE, listed here in gimple_call_initialize_ctrl_altering: ... /* IFN_UNIQUE should be the last insn, to make checking for it as cheap as possible. */ || (gimple_call_internal_p (stmt) && gimple_call_internal_unique_p (stmt))) gimple_call_set_ctrl_altering (stmt, true); ... Recent commit fab77644842 "tree-optimization/96931 - clear ctrl-altering flag more aggressively" breaks this invariant, causing an ICE triggered during libgomp testing for x86_64 with nvptx accelerator: ... during RTL pass: mach asyncwait-1.f90: In function ‘MAIN__._omp_fn.0’: asyncwait-1.f90:19: internal compiler error: in nvptx_find_par, at \ config/nvptx/nvptx.c:3293 ... Fix this by listing IFN_UNIQUE as exception in cleanup_call_ctrl_altering_flag. Build for x86_64 with nvptx accelerator, tested libgomp. Committed to trunk. Thanks, - Tom [tree-optimization] Don't clear ctrl-altering flag for IFN_UNIQUE gcc/ChangeLog: PR tree-optimization/97000 * tree-cfgcleanup.c (cleanup_call_ctrl_altering_flag): Don't clear flag for IFN_UNIQUE. --- gcc/tree-cfgcleanup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index f8169eef781..f2edd3fd2e5 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -212,7 +212,11 @@ static void cleanup_call_ctrl_altering_flag (basic_block bb, gimple *bb_end) { if (!is_gimple_call (bb_end) - || !gimple_call_ctrl_altering_p (bb_end)) + || !gimple_call_ctrl_altering_p (bb_end) + || (/* IFN_UNIQUE should be the last insn, to make checking for it + as cheap as possible. */ + gimple_call_internal_p (bb_end) + && gimple_call_internal_unique_p (bb_end))) return; int flags = gimple_call_flags (bb_end);