https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81958
--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to Jeffrey A. Law from comment #1) > 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. So, split into separate bugs? Or leave as just this one?