Jakub Jelinek wrote:
The minloc/maxloc intrinsics without DIM argument used on rank 1 arrays
aren't inline optimized, because unlike their DIM=1 counterparts they
return a rank 1 array with size 1.  Handling that during genericization
looked too hard to me, so instead this patch optimizes
minloc (a) for rank 1 a into (/ minloc (a, dim=1) /) during frontend 
optimizations.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK - with one nit fixed: Please update the comment to reflect the current code. (No longer only assignments, uses array constructor.)

+/* Optimize a = minloc(b), where b is rank 1 array, into
+   a = minloc(b, dim=1), and similarly for maxloc,
+   as the latter forms are expanded inline.  */

Thanks for the patch!

Tobias

Reply via email to