This is the mail archive of the gcc-bugs@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]

[Bug fortran/31593] Invariant DO loop variables and subroutines



------- Comment #21 from tobi at gcc dot gnu dot org  2009-08-14 21:44 -------
(In reply to comment #19)
> (In reply to comment #17)
> From quickly looking at the code, the copy to real_to is probably unnecessary
> because loop bounds are passed through gfc_evaluate_now before calling
> gfc_trans_simple_do ( never mind if it gives the good assembly :) ).

I suspected that this reason wouldn't hold.  Place a wrong statement on the
internet, you will no after a few seconds :)  The real reason is that no
pointer to the upper bound that is compared against can escape, so that better
assembler will result.  I will update the comment.

> Couldn't the same be made in gfc_trans_do ?

There, the number of iterations is calculated before the loop, so the problem
doesn't arise.  I'm guessing that before my patch, gfc_trans_simple_do actually
lead to a net slowdown of the generated code.  Lesson learnt: don't optimize
without measuring or at least looking at the generated code :)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31593


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