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 tree-optimization/26731] Jump threading gets in the way of loops


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26731

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Indeed x += n needs to be guarded with n > 0 - and we analyze that correctly:

Analyzing # of iterations of loop 1
  exit condition [1, + , 1](no_overflow) < a_10
  bounds on difference of bases: -2147483649 ... 2147483646
  result:
    zero if a_10 <= 0
    # of iterations (unsigned int) a_10 + 4294967295, bounded by 2147483646

but SCEV cprop doesn't handle this as it thinks that

  (x_6(D) + 1) + (a_10 > 0 ? (int) ((unsigned int) a_10 + 4294967295) : 0)

is expensive.

Of course it should have used number_of_iterations_exit instead to be able
to insert the may_be_zero condition properly which its simplistic code
doesn't handle.

Without jump threading the analysis is able to simplify the may_be_zero
condition against the dominating header copy checks.

Thus re-confirmed.


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