My pretty-ipa merge 4: Fix cgraph edge building in omp lowering
Martin Jambor
mjambor@suse.cz
Sun Mar 29 20:59:00 GMT 2009
Hi,
the original email describing this patch is at:
http://gcc.gnu.org/ml/gcc-patches/2009-02/msg00732.html
omp-low.c fails to create any call graph edges for its newly created
functions because it does not set current_function_decl when calling
rebuild_cgraph_edges() which requires it to function properly. The
patch below fixes this.
Again, I do not have a separate testcase for this bug but there is
already a test case in our test suite which my IPA-SRA iscompiles
without this fix.
I have bootstrapped and tested this on trunk on x86_64-linux
yesterday. This patch has been on pretty-ipa since February. OK for
trunk?
Thanks,
Martin
2009-03-29 Martin Jambor <mjambor@suse.cz>
* omp-low.c (expand_omp_taskreg): Always set current_function_decl.
Index: mine/gcc/omp-low.c
===================================================================
--- mine.orig/gcc/omp-low.c 2009-03-29 00:55:58.000000000 +0100
+++ mine/gcc/omp-low.c 2009-03-29 19:48:04.000000000 +0200
@@ -3244,6 +3244,7 @@ expand_omp_taskreg (struct omp_region *r
basic_block entry_bb, exit_bb, new_bb;
struct function *child_cfun;
tree child_fn, block, t, ws_args, *tp;
+ tree save_current;
gimple_stmt_iterator gsi;
gimple entry_stmt, stmt;
edge e;
@@ -3429,6 +3430,8 @@ expand_omp_taskreg (struct omp_region *r
/* Fix the callgraph edges for child_cfun. Those for cfun will be
fixed in a following pass. */
push_cfun (child_cfun);
+ save_current = current_function_decl;
+ current_function_decl = child_fn;
if (optimize)
optimize_omp_library_calls (entry_stmt);
rebuild_cgraph_edges ();
@@ -3440,16 +3443,14 @@ expand_omp_taskreg (struct omp_region *r
if (flag_exceptions)
{
basic_block bb;
- tree save_current = current_function_decl;
bool changed = false;
- current_function_decl = child_fn;
FOR_EACH_BB (bb)
changed |= gimple_purge_dead_eh_edges (bb);
if (changed)
cleanup_tree_cfg ();
- current_function_decl = save_current;
}
+ current_function_decl = save_current;
pop_cfun ();
}
More information about the Gcc-patches
mailing list