From patchwork Tue Jun 15 17:37:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fang, Changpeng" X-Patchwork-Id: 55765 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]) by ozlabs.org (Postfix) with SMTP id B12CE100803 for ; Wed, 16 Jun 2010 03:37:55 +1000 (EST) Received: (qmail 5933 invoked by alias); 15 Jun 2010 17:37:53 -0000 Received: (qmail 5920 invoked by uid 22791); 15 Jun 2010 17:37:51 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from tx2ehsobe002.messaging.microsoft.com (HELO TX2EHSOBE004.bigfish.com) (65.55.88.12) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 Jun 2010 17:37:34 +0000 Received: from mail58-tx2-R.bigfish.com (10.9.14.245) by TX2EHSOBE004.bigfish.com (10.9.40.24) with Microsoft SMTP Server id 8.1.340.0; Tue, 15 Jun 2010 17:37:32 +0000 Received: from mail58-tx2 (localhost.localdomain [127.0.0.1]) by mail58-tx2-R.bigfish.com (Postfix) with ESMTP id 13BF44007C9; Tue, 15 Jun 2010 17:37:32 +0000 (UTC) X-SpamScore: -3 X-BigFish: VPS-3(zz4015Lzz1202hzzz32i2a8h34h43h61h) X-Spam-TCS-SCL: 0:0 Received: from mail58-tx2 (localhost.localdomain [127.0.0.1]) by mail58-tx2 (MessageSwitch) id 1276623451819961_24354; Tue, 15 Jun 2010 17:37:31 +0000 (UTC) Received: from TX2EHSMHS010.bigfish.com (unknown [10.9.14.247]) by mail58-tx2.bigfish.com (Postfix) with ESMTP id C3F7EC0004F; Tue, 15 Jun 2010 17:37:31 +0000 (UTC) Received: from ausb3extmailp01.amd.com (163.181.251.8) by TX2EHSMHS010.bigfish.com (10.9.99.110) with Microsoft SMTP Server (TLS) id 14.0.482.44; Tue, 15 Jun 2010 17:37:28 +0000 Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp01.amd.com (Switch-3.2.7/Switch-3.2.7) with SMTP id o5FHIiRN022842; Tue, 15 Jun 2010 12:18:47 -0500 X-M-MSG: Received: from sausexhtp02.amd.com (sausexhtp02.amd.com [163.181.3.152]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by ausb3twp02.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 21A64C8770; Tue, 15 Jun 2010 12:37:22 -0500 (CDT) Received: from SAUSEXMBP01.amd.com ([163.181.3.198]) by sausexhtp02.amd.com ([163.181.3.152]) with mapi; Tue, 15 Jun 2010 12:37:23 -0500 From: "Fang, Changpeng" To: "gcc-patches@gcc.gnu.org" , "rguenther@suse.de" CC: "sebpop@gmail.com" , Zdenek Dvorak Date: Tue, 15 Jun 2010 12:37:22 -0500 Subject: [PATCH, PR44503] Fixes "control flow in the middle of basic block" with -fprefetch-loop-arrays Message-ID: MIME-Version: 1.0 X-Reverse-DNS: unknown 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 Hi, Attached is the patch to fix bug 44503: "control flow in the middle of basic block" with -fprefetch-loop-arrays. The problem is that a non-local label (for setjmp) exists in the function. When we insert a _builtin_prefetch call, this prefetch is considered potentially changing the control flow. We think this is, in general, a loop construction problem. When the current function has non local labels, there are no natural loops in the function. The patch passed bootstrapping and gcc regression tests on amd-linux64 systems. Is it ok for the trunk? Thanks, Changpeng From 91dd3df467e121426131cf477a77eb07d6062438 Mon Sep 17 00:00:00 2001 From: Changpeng Fang Date: Mon, 14 Jun 2010 16:46:06 -0700 Subject: [PATCH 3/3] Do not form natural loops when non-local labels exist in the current function *cfgloop.c (flow_loops_find): When the current function has non local labels, there are no natural loops in the function. --- gcc/cfgloop.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index 858e75b..d2ba445 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -394,6 +394,18 @@ flow_loops_find (struct loops *loops) return 1; } + /* When the current function has non local labels, there are no + natural loops in the function. */ + if (cfun->has_nonlocal_label) + { + init_loops_structure (loops, 1); + + FOR_EACH_BB (bb) + bb->loop_father = loops->tree_root; + + return 1; + } + dfs_order = NULL; rc_order = NULL; -- 1.6.3.3