From patchwork Tue Jun 15 17:37:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [PR44503] Fixes "control flow in the middle of basic block" with -fprefetch-loop-arrays From: "Fang, Changpeng" X-Patchwork-Id: 55765 Message-Id: To: "gcc-patches@gcc.gnu.org" , "rguenther@suse.de" Cc: "sebpop@gmail.com" , Zdenek Dvorak Date: Tue, 15 Jun 2010 12:37:22 -0500 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