Message ID | 20100920222130.27269.37937@gimli.local |
---|---|
State | New |
Headers | show |
Mikael, This is also OK. Paul On 9/21/10, Mikael Morin <mikael.morin@sfr.fr> wrote: > With this, the transpose optimization is back. > The two previous patches permitted to call gfc_conv_expr_descriptor on > transpose's arg, so now we just have to bypass the temporary generation in > the transpose case. > I don't add the testcase from the original commit as there is a wrong code > regression introduced by this patch (uncaught by the testsuite) to be fixed > in patch 5/5. > > OK for trunk ? > > >
On Mon, Sep 20, 2010 at 3:21 PM, Mikael Morin <mikael.morin@sfr.fr> wrote: > With this, the transpose optimization is back. > The two previous patches permitted to call gfc_conv_expr_descriptor on transpose's arg, so now we just have to bypass the temporary generation in the transpose case. > I don't add the testcase from the original commit as there is a wrong code regression introduced by this patch (uncaught by the testsuite) to be fixed in patch 5/5. > > OK for trunk ? > This change is unsafe and caused: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46842
diff --git a/trans-array.c b/trans-array.c index 52e6d2a..9171183 100644 --- a/trans-array.c +++ b/trans-array.c @@ -5175,6 +5175,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) tree offset; int full; bool subref_array_target = false; + gfc_expr *arg; gcc_assert (ss != gfc_ss_terminator); @@ -5253,6 +5254,19 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) break; case EXPR_FUNCTION: + + /* We don't need to copy data in some cases. */ + arg = gfc_get_noncopying_intrinsic_argument (expr); + if (arg) + { + /* This is a call to transpose... */ + gcc_assert (expr->value.function.isym->id == GFC_ISYM_TRANSPOSE); + /* ... which has already been handled by the scalarizer, so + that we just need to get its argument's descriptor. */ + gfc_conv_expr_descriptor (se, expr->value.function.actual->expr, ss); + return; + } + /* A transformational function return value will be a temporary array descriptor. We still need to go through the scalarizer to create the descriptor. Elemental functions ar handled as