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

--- Comment #9 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Created attachment 31485
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31485&action=edit
change code generation for simple DO-loops

This not yet fully tested patch changes the DO-loop code generation
to a more loop-niter frendly way.

before:
   if ((step > 0) ? (dovar <= to) : (dovar => to))
    {
      for (;;)
        {
          body;
   cycle_label:
          cond = (dovar == to);
          dovar += step;
          if (cond) goto end_label;
        }
      }
   end_label:


after:
   if ((step > 0) ? (dovar <= to) : (dovar => to))
    {
      for (;;)
        {
          body;
   cycle_label:
          cond = (step > 0) ? (dovar >= to) : (dovar <= to);
          dovar += step;
          if (cond) goto end_label;
        }
      }
   end_label:

this is more easy to see, that dovar can not overflow:
what do you think of it?

Reply via email to