https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81958
Jeffrey A. Law <law at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-09-30 CC| |law at redhat dot com Blocks| |19794 Ever confirmed|0 |1 --- Comment #1 from Jeffrey A. Law <law at redhat dot com> --- So I see a couple things here. In DOM we do catch the fact that eqidx will have the value zero if the loop does not iterate. But the equivalence we record is actually eqidx >= maxidx. That's because we don't cprop into the conditionals in record_temporary_equivalences. We *should* do that, but we have to be careful about structure sharing and I'd like to avoid creating a lot of unnecessary tree nodes if it can be avoided. If we were to fix that, we'd end recording maxidx <= 0. Given that maxidx is unsigned that simplifies into maxidx == 0. Of course we don't those kind of simplifications when recording the temporary equivalences either and the same concerns WRT structure sharing come into play. When things simplify into something like maxidx == 0, instead of recording a conditional into the equivalency tables, we should record that maxidx = 0 in the const/copies table. If we were to fix those 3 issues, then I think we have all the key pieces in place to see the jump thread. But we still have to be concerned that jump threading may be suppressed because of its conservatism WRT not clobbering the loop structure. It should be safe in this case, but I don't offhand know if the suppression code would kick in or not. So, anyway, there's several TODO items in here. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19794 [Bug 19794] [meta-bug] Jump threading related bugs