From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128613 invoked by alias); 18 Mar 2015 07:45:31 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 128576 invoked by uid 48); 18 Mar 2015 07:45:27 -0000 From: "vries at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/65458] New: parloops transforms omp-generated functions Date: Wed, 18 Mar 2015 07:45:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-03/txt/msg01763.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65458 Bug ID: 65458 Summary: parloops transforms omp-generated functions Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vries at gcc dot gnu.org parloops parallelizes loops by: - analyzing dependencies - lowering the loop body - annotating the loop with omp parallel and loop pragmas - omp-expanding the loop into a seperate function - replacing the loop with a call to a runtime function, which will run the split-off function in several threads. Parloops has a mechanism to not process again functions that were created by parloops (parallelized_function_p). However, if a source file contains omp pragmas that cause loops to be transformed and split off into seperate functions, there is nothing stopping parloops from processing those functions again. The result is a thread function that itself again creates threads. Look for instance at: ... gcc -fopenmp -O2 -std=c99 src/gcc/testsuite/gcc.dg/gomp/pr25990.c -S -fdump-tree-all-all -ftree-parallelize-loops=2 ... We can see main._omp_fn.1._loopfn.0 in this list: ... $ grep Function pr25990.c.123t.parloops ;; Function main._omp_fn.0 (main._omp_fn.0, funcdef_no=1, decl_uid=2010, cgraph_uid=1, symbol_order=1) ;; Function main._omp_fn.1 (main._omp_fn.1, funcdef_no=2, decl_uid=2047, cgraph_uid=2, symbol_order=2) ;; Function main (main, funcdef_no=0, decl_uid=1739, cgraph_uid=0, symbol_order=0) (executed once) ;; Function main._omp_fn.1._loopfn.0 (main._omp_fn.1._loopfn.0, funcdef_no=3, decl_uid=2397, cgraph_uid=14, symbol_order=14) ;; Function main._loopfn.1 (main._loopfn.1, funcdef_no=4, decl_uid=2512, cgraph_uid=15, symbol_order=15) ... I think we should handle functions splitt off by omp processing conservatively in parloops.