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: ivopts improvement


On 02/28/2011 10:41 AM, Tom de Vries wrote:
The difficulty is that this replacement is only valid under the
guarantee that base + n does not overflow.

I think this should be done unconditionally under -funsafe-loop-optimizations. Look in the code for examples of how to add warnings, it should be something like:


  bool last_iter_may_overflow;
  if (TYPE_OVERFLOW_WRAPS (...))
    last_iter_may_overflow = false;
  else
    {
      last_iter_may_overflow = !flag_unsafe_loop_optimizations;
      if (warn_unsafe_loop_optimizations)
        {
          if (flag_unsafe_loop_optimizations)
            warning ("assuming ... does not overflow");
          else
            warning ("not optimizing ... because ... could overflow");
        }
    }

  if (last_iter_may_overflow
      && stmt_after_increment (loop, cand, use->stmt))

Looks like good work, thanks!

Paolo


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