This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, fortran] PR 37131, inline matmul
- From: Thomas Koenig <tkoenig at netcologne dot de>
- To: Mikael Morin <mikael dot morin at sfr dot fr>, Thomas Schwinge <thomas at codesourcery dot com>, Bernd Schmidt <bernds at codesourcery dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Tue, 21 Jul 2015 21:49:44 +0200
- Subject: Re: [Patch, fortran] PR 37131, inline matmul
- Authentication-results: sourceware.org; auth=none
- References: <55486270 dot 8010909 at netcologne dot de> <5548BE61 dot 1090506 at sfr dot fr> <554A78F7 dot 5010300 at netcologne dot de> <87vbdnzvd4 dot fsf at kepler dot schwinge dot homeip dot net> <55AD6E53 dot 90800 at netcologne dot de> <55AE80D3 dot 1070600 at sfr dot fr>
Am 21.07.2015 um 19:26 schrieb Mikael Morin:
Le 20/07/2015 23:55, Thomas Koenig a Ãcrit :
Hi,
I'm back from holiday, so I can finally reply.
Am 13.07.2015 um 21:54 schrieb Thomas Schwinge:
--- gcc/fortran/iresolve.c
+++ gcc/fortran/iresolve.c
@@ -2207,6 +2207,9 @@ gfc_resolve_fe_runtime_error (gfc_code *c)
a->name = "%VAL";
c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
+ //TODO
+ extern tree gfor_fndecl_runtime_error;
+ c->resolved_sym->backend_decl = gfor_fndecl_runtime_error;
}
This patch actually works quite well. I cannot check the varargs part
on x86_64, but the non-return part is OK. Obviously, the backend decl
for runtime_error needs to be set.
The question is where to put this. iresolve.c seems conceptually wrong,
but I cannot find a clean place to put this in trans-*, without
special casing in strange places.
For what it's worth, I had started hacking on this; I attach what it
looks like after a few cleanups.
This looks OK. You're right, it is more clean (although it replaces
a one-line patch with a 150-line one :-)
I would like to avoid the hack in iresolve. So let's reuse the
frontend-passes.c part of my patch (set resolved_isym)
I would much prefer if that was put into gfc_resolve_fe_runtime_error,
next to the assignment to c->resolved_sym.
and then handle
it in gfc_conv_intrinsic_subroutine, the way my patch does it (I'm not
sure it actually fixes anything) or some other way (set
resolved_sym->backend_decl as in iresolve, ...).
It does actually fix the issue. One way of constructing a test case
is to run
$ gfortran -fdump-tree-optimized -fno-realloc-lhs -fcheck=all -O -S
inline_matmul_2.f90
and count the number of calls to "_gfortran_runtime_error " in the
*.optimized dump (without the _at). It should be zero.
So, OK from my side with the change above and corresponding test case.
Regards
Thomas