From patchwork Wed Jul 1 16:11:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 490231 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 16F3D1402AC for ; Thu, 2 Jul 2015 02:11:41 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=l230wxn3; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=YTFZoYL0mpXznhgJTXb+b7Ilt0N6ERobYDm+QV5V1ko oGJW2A0n5xWaT+iYmPHN5NF7SToVe51cuE9+UqXn4o5DiCzxloTvmTQ2PxB3oonC rrU5CYuVwTwjYpUzk90+ctR+T3poyl492H6X5n9FzaUpOJAUsOfk0891wJIIpuuE = 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 :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=77UolBjb9j7C9SvSgz9KJ9bJ2Z4=; b=l230wxn36vbS1N35F 259YHkbNB/XyxIRfR5Wo2hsbu1SH9ABlo4YfQtQROF/WzMucg0Qje3WBODg4ose8 8bU2POuR6Ljgnl/Vu8UodvHLPTcWgis+wh0iq11gOGeyoPNBqg8dEV2rl09MRYMs e3EnUupr7+X1lgNxOKPjhzGwAM= Received: (qmail 43988 invoked by alias); 1 Jul 2015 16:11: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 43976 invoked by uid 89); 1 Jul 2015 16:11:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 01 Jul 2015 16:11:31 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59103) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ZAKbg-0007Nr-Vf for gcc-patches@gnu.org; Wed, 01 Jul 2015 12:11:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAKbZ-0004qw-5U for gcc-patches@gnu.org; Wed, 01 Jul 2015 12:11:28 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:48045) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAKbY-0004qa-SO for gcc-patches@gnu.org; Wed, 01 Jul 2015 12:11:21 -0400 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZAKbW-0005tp-Uu from Tom_deVries@mentor.com ; Wed, 01 Jul 2015 09:11:19 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Wed, 1 Jul 2015 17:11:17 +0100 Message-ID: <5594111C.50904@mentor.com> Date: Wed, 1 Jul 2015 18:11:08 +0200 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "gcc-patches@gnu.org" CC: Jakub Jelinek Subject: [gomp4, committed, PR66716] Fix compilation libgomp.oacc-c-c++-common/kernels-loop.c -g X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 Hi, when compiling libgomp.oacc-c-c++-common/kernels-loop at -O2 -g, we run into: ... FAIL: libgomp.oacc-c/../libgomp.oacc-c-c++-common/kernels-loop.c -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 (internal compiler error) ... The ICE in more detail: ... src/libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/kernels-loop.c: In function ‘main’: src/libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/kernels-loop.c:41:1: error: definition in block 10 does not dominate use in block 19 for SSA_NAME: ii_69 in statement: # DEBUG ii => ii_69 src/libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/kernels-loop.c:41:1: internal compiler error: verify_ssa failed 0x1123966 verify_ssa(bool, bool) src/gcc/tree-ssa.c:1068 0xd1a9d8 execute_function_todo src/gcc/passes.c:1953 0xd19abf do_per_function src/gcc/passes.c:1638 0xd1ab76 execute_todo src/gcc/passes.c:2003 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions ... Before transform_to_exit_first_loop_alt we have this loop: ... goto ; : # ivtmp_19 = PHI ii_36 = ivtmp_19; # DEBUG ii => ii_36 _52 = (long unsigned int) ii_36; _53 = _52 * 4; _54 = c.6_51 + _53; _59 = a.7_56 + _53; _60 = *_59; _65 = b.8_62 + _53; _66 = *_65; _67 = _60 + _66; *_54 = _67; ii_69 = ii_36 + 1; # DEBUG ii => ii_69 # DEBUG ii => ii_69 if (ivtmp_19 < 524287) goto ; else goto ; : ivtmp_7 = ivtmp_19 + 1; goto ; ... And after transform_to_exit_first_loop_alt we have this loop: ... goto ; : # ivtmp_19 = PHI ii_36 = ivtmp_19; # DEBUG ii => ii_36 _52 = (long unsigned int) ii_36; _53 = _52 * 4; _54 = c.6_51 + _53; _59 = a.7_56 + _53; _60 = *_59; _65 = b.8_62 + _53; _66 = *_65; _67 = _60 + _66; *_54 = _67; ii_69 = ii_36 + 1; goto ; : # ivtmp_35 = PHI # DEBUG ii => ii_69 # DEBUG ii => ii_69 if (ivtmp_35 < 524288) goto ; else goto ; : ivtmp_7 = ivtmp_19 + 1; goto ; ... So, the use of ii_69 in debug insn 'DEBUG ii => ii_69' in bb 19 is no longer dominated by the def of ii_68 in bb 10. The patch fixes this by ensuring that gimple_split_block_before_cond_jump really splits before cond_jump, instead of after the last nondebug insn before cond_jump, as it does now. This behaviour also better matches the rtl implementation of the cfghook. Btw, note that the only user of cfghook split_block_before_cond_jump is transform_to_exit_first_loop_alt. Committed to gomp-4_0-branch. Thanks, - Tom Fix compilation libgomp.oacc-c-c++-common/kernels-loop.c -g 2015-07-01 Tom de Vries PR tree-optimization/66716 * tree-cfg.c (gimple_split_block_before_cond_jump): Split before cond_jump, instead of split after last nondebug insn before cond_jump. * c-c++-common/goacc/kernels-loop-g.c: New test. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-g.c: New test. --- gcc/testsuite/c-c++-common/goacc/kernels-loop-g.c | 19 +++++++++++++++++++ gcc/tree-cfg.c | 2 +- .../libgomp.oacc-c-c++-common/kernels-loop-g.c | 5 +++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/c-c++-common/goacc/kernels-loop-g.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-loop-g.c diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-loop-g.c b/gcc/testsuite/c-c++-common/goacc/kernels-loop-g.c new file mode 100644 index 0000000..331503a --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/kernels-loop-g.c @@ -0,0 +1,19 @@ +/* { dg-additional-options "-O2" } */ +/* { dg-additional-options "-g" } */ +/* { dg-additional-options "-ftree-parallelize-loops=32" } */ +/* { dg-additional-options "-fdump-tree-parloops_oacc_kernels-all" } */ +/* { dg-additional-options "-fdump-tree-optimized" } */ + +#include "kernels-loop.c" + +/* Check that only one loop is analyzed, and that it can be parallelized. */ +/* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops_oacc_kernels" } } */ +/* { dg-final { scan-tree-dump-not "FAILED:" "parloops_oacc_kernels" } } */ + +/* Check that the loop has been split off into a function. */ +/* { dg-final { scan-tree-dump-times "(?n);; Function .*main._omp_fn.0" 1 "optimized" } } */ + +/* { dg-final { scan-tree-dump-times "(?n)pragma omp target oacc_parallel.*num_gangs\\(32\\)" 1 "parloops_oacc_kernels" } } */ + +/* { dg-final { cleanup-tree-dump "parloops_oacc_kernels" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 99b27c7..a8aec26 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -5837,7 +5837,7 @@ gimple_split_block_before_cond_jump (basic_block bb) if (gimple_code (last) != GIMPLE_COND && gimple_code (last) != GIMPLE_SWITCH) return NULL; - gsi_prev_nondebug (&gsi); + gsi_prev (&gsi); split_point = gsi_stmt (gsi); return split_block (bb, split_point)->dest; } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-loop-g.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-loop-g.c new file mode 100644 index 0000000..96b6e4e --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-loop-g.c @@ -0,0 +1,5 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-parallelize-loops=32" } */ +/* { dg-additional-options "-g" } */ + +#include "kernels-loop.c" -- 1.9.1