diff options
author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-20 17:50:17 +0000 |
---|---|---|
committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-20 17:50:17 +0000 |
commit | 46515c92028119045eb61d6f79fd9a6865e2734a (patch) | |
tree | 541b4a163141e39bc6fc37017881bc7f9e447015 /gcc/omp-low.c | |
parent | a18d30a8e57888e0861a1e07d5002517ca96dd26 (diff) | |
download | gcc-46515c92028119045eb61d6f79fd9a6865e2734a.tar.gz |
2006-12-20 Andrew Pinski <pinskia@gmail.com>
PR middle-end/30143
* omp-low.c (init_tmp_var): New function.
(save_tmp_var): New function.
(lower_omp_1): Use them for VAR_DECL.
2006-12-20 Andrew Pinski <pinskia@gmail.com>
PR middle-end/30143
* gcc.dg/gomp/complex-1.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120080 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index e744a244fe3..f3f4113b98c 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -4190,6 +4190,38 @@ lower_regimplify (tree *tp, struct walk_stmt_info *wi) tsi_link_before (&wi->tsi, pre, TSI_SAME_STMT); } +/* Copy EXP into a temporary. Insert the initialization statement before TSI. */ + +static tree +init_tmp_var (tree exp, tree_stmt_iterator *tsi) +{ + tree t, stmt; + + t = create_tmp_var (TREE_TYPE (exp), NULL); + DECL_GIMPLE_REG_P (t) = 1; + stmt = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (t), t, exp); + SET_EXPR_LOCUS (stmt, EXPR_LOCUS (tsi_stmt (*tsi))); + tsi_link_before (tsi, stmt, TSI_SAME_STMT); + + return t; +} + +/* Similarly, but copy from the temporary and insert the statement + after the iterator. */ + +static tree +save_tmp_var (tree exp, tree_stmt_iterator *tsi) +{ + tree t, stmt; + + t = create_tmp_var (TREE_TYPE (exp), NULL); + DECL_GIMPLE_REG_P (t) = 1; + stmt = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (t), exp, t); + SET_EXPR_LOCUS (stmt, EXPR_LOCUS (tsi_stmt (*tsi))); + tsi_link_after (tsi, stmt, TSI_SAME_STMT); + + return t; +} /* Callback for walk_stmts. Lower the OpenMP directive pointed by TP. */ @@ -4255,7 +4287,17 @@ lower_omp_1 (tree *tp, int *walk_subtrees, void *data) case VAR_DECL: if (ctx && DECL_HAS_VALUE_EXPR_P (t)) - lower_regimplify (tp, wi); + { + lower_regimplify (&t, wi); + if (wi->val_only) + { + if (wi->is_lhs) + t = save_tmp_var (t, &wi->tsi); + else + t = init_tmp_var (t, &wi->tsi); + } + *tp = t; + } break; case ADDR_EXPR: |