------- 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

  • ... rguenth at gcc dot gnu dot org
  • ... tobi at gcc dot gnu dot org
  • ... tkoenig at gcc dot gnu dot org
  • ... Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
  • ... tobi at gcc dot gnu dot org
  • ... tobi at gcc dot gnu dot org
  • ... tobi at gcc dot gnu dot org
  • ... jvdelisle at gcc dot gnu dot org
  • ... mikael at gcc dot gnu dot org
  • ... tobi at gcc dot gnu dot org
  • ... tobi at gcc dot gnu dot org
  • ... tobi at gcc dot gnu dot org
  • ... tkoenig at gcc dot gnu dot org
  • ... tobi at gcc dot gnu dot org
  • ... tobi at gcc dot gnu dot org
  • ... tobi at gcc dot gnu dot org
  • ... jv244 at cam dot ac dot uk
  • ... jv244 at cam dot ac dot uk
  • ... tkoenig at gcc dot gnu dot org
  • ... tkoenig at gcc dot gnu dot org
  • ... tobi at gcc dot gnu dot org

Reply via email to