This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [FORTRAN] Avoid allocating unused WHERE masks


Quoting Roger Sayle <roger@eyesopen.com>:
> Ok for mainline?  WHERE statements without ELSEWHERE clauses should
> now allocate 1/8th of the memory they did previously (combined with
> the recent LOGICAL*4 to LOGICAL*1 patch), except for those around a
> single independent assignment which now require no allocations.
>
> SteveK, could you retry the code you mentioned to see whether the
> increased memory requirements you observed have now been resolved?
>
>
>
> 2006-02-06  Roger Sayle  <roger@eyesopen.com>
>
> 	* trans-stmt.c (gfc_evaluate_where_mask): Allow the NMASK argument
> 	to be NULL to indicate that the not mask isn't required.
> 	(gfc_trans_where_2): Remove PMASK argument.  Avoid calculating the
> 	pending mask for the last clause of a WHERE chain. Update
> 	recursive call.
> 	(gfc_trans_forall_1): Update call to gfc_trans_where_2.
> 	(gfc_trans_where): Likewise.

Ok, modulo two minor issues:

> *************** tree gfc_trans_forall (gfc_code * code)
> *** 2623,2631 ****
>      the nested forall.
>      ME is the WHERE mask expression.
>      MASK is the temporary which value is mask's value.
> !    NMASK is another temporary which value is !mask.
> !    TEMP records the temporary's address allocated in this function in order
> to
> !    free them outside this function.
>      MASK, NMASK and TEMP are all OUT arguments.  */
>
>   static tree
> --- 2623,2631 ----
>      the nested forall.
>      ME is the WHERE mask expression.
>      MASK is the temporary which value is mask's value.
                             ^^^^^
> !    NMASK is another temporary which value is !mask, or NULL if not
                                  ^^^^^
> required.
> !    TEMP records the temporary's address allocated in this function in order
> !    to free them outside this function.
>      MASK, NMASK and TEMP are all OUT arguments.  */

I see that this is preexisting code, but since you're copying it, I shall ask
you a linguistic question: is this correct English?  (I would have expected
'whose'.)

> --- 3027,3045 ----
>         /* Has mask-expr.  */
>         if (cblock->expr)
>           {
> + 	  /* If this is the last clause of the WHERE construct, then
> + 	     we don't need to allocate/populate/deallocate a pmask.  */
                                                             ^^^^^
Your patch removes the preceding definition of pmask, so please make explicit
what this means.

Thanks,
- Tobi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]