This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/26731] Jump threading gets in the way of loops
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 09 Dec 2014 14:40:25 +0000
- Subject: [Bug tree-optimization/26731] Jump threading gets in the way of loops
- Auto-submitted: auto-generated
- References: <bug-26731-4 at http dot gcc dot gnu dot org/bugzilla/>
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.