From patchwork Thu Oct 20 17:41:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 59210 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 39CF5384BC22 for ; Thu, 20 Oct 2022 17:42:17 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 62610384D153 for ; Thu, 20 Oct 2022 17:42:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 62610384D153 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.95,199,1661846400"; d="diff'?scan'208";a="87946031" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 20 Oct 2022 09:42:01 -0800 IronPort-SDR: +WqYoIuaO4HDJjA2oTC1Sdveled1CbIwGLlug2NLZHX2bSPNnmNlNAW+fL0wjm/7/CJNs22WgD laX/VAlzM7OyTvHNIk+/f4z7AQYUNcgBqaTenQQ16mewcQ1MA/PdPgXWes2tJUu9/bRv0F/3S3 jda59dG4UFg+b2KFcVn56GNVjAt+iqTDX1XhW608HcixKDgNZULRNfi9QTQYjVdEGzQXXv9lAH UVX+x4Tv8ny/0CCdDuEFhYiOj4rmMgAzJQvuKcQhcO/wtduY8dUSdgwmrGydQym98T93d55lcZ QJo= Message-ID: Date: Thu, 20 Oct 2022 19:41:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Content-Language: en-US To: gcc-patches From: Tobias Burnus Subject: [OG12] omp-oacc-kernels-decompose.cc: fix -fcompare-debug with GIMPLE_DEBUG X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-14.mgc.mentorg.com (139.181.222.14) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Given that omp-oacc-kernels-decompose.cc only exists on OG12, the fix only applies to OG12. The fail show up since "Kernels loops annotation: C and C++." as that adds GIMPLE_DEBUG which is not handled in omp-oacc-kernels-decompose.cc at all. (Actually, it even fails with a sorry when compiling with -g2; however, -fcompare-debug is supported and was failing.) – For details see patch. Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 commit 807b755357c4eb03260d229f4a851009fe058e51 Author: Tobias Burnus Date: Thu Oct 20 19:20:36 2022 +0200 omp-oacc-kernels-decompose.cc: fix -fcompare-debug with GIMPLE_DEBUG GIMPLE_DEBUG were put in a parallel region of its own, which is not only pointless but also breaks -fcompare-debug. With this commit, they are handled like simple assignments: those placed are places into the same body as the loop such that only one parallel region remains as without debugging. This fixes the existing testcase libgomp.oacc-c-c++-common/kernels-loop-g.c. Note: GIMPLE_DEBUG are only accepted with -fcompare-debug; if they appear otherwise, decompose_kernels_region_body rejects them with a sorry (unchanged). gcc/ * omp-oacc-kernels-decompose.cc (top_level_omp_for_in_stmt, decompose_kernels_region_body): Handle GIMPLE_DEBUG like simple assignment. --- gcc/omp-oacc-kernels-decompose.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/omp-oacc-kernels-decompose.cc b/gcc/omp-oacc-kernels-decompose.cc index 4e940c1ee0f..a7e3d764d52 100644 --- a/gcc/omp-oacc-kernels-decompose.cc +++ b/gcc/omp-oacc-kernels-decompose.cc @@ -120,7 +120,8 @@ top_level_omp_for_in_stmt (gimple *stmt) for (gsi = gsi_start (body); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple *body_stmt = gsi_stmt (gsi); - if (gimple_code (body_stmt) == GIMPLE_ASSIGN) + if (gimple_code (body_stmt) == GIMPLE_ASSIGN + || gimple_code (body_stmt) == GIMPLE_DEBUG) continue; else if (gimple_code (body_stmt) == GIMPLE_OMP_FOR && gsi_one_before_end_p (gsi)) @@ -1398,7 +1399,7 @@ decompose_kernels_region_body (gimple *kernels_region, tree kernels_clauses) = (gimple_code (stmt) == GIMPLE_ASSIGN && TREE_CODE (gimple_assign_lhs (stmt)) == VAR_DECL && DECL_ARTIFICIAL (gimple_assign_lhs (stmt))); - if (!is_simple_assignment) + if (!is_simple_assignment && gimple_code (stmt) != GIMPLE_DEBUG) only_simple_assignments = false; } }