This is an archive of the discontinued LLVM Phabricator instance.

Fix a naming issue in recurrence matcher
AbandonedPublic

Authored by reames on Mar 17 2021, 12:46 PM.

Details

Reviewers
mkazantsev
bollu
Summary

This was brought up in D98222. The recently added matchSimpleRecurrence doesn't actually match a recurrence (oops). It matches something which is nearly a recurrence, but allows one additional free variable.

This patch splits the concept into a true recurrence matcher and a "near" recurrence matcher, and tries to clarify some comments. I'm not particularly a fan of the "near" wording, but I haven't found anything better just yet. Suggestions welcome.

Diff Detail

Event Timeline

reames created this revision.Mar 17 2021, 12:46 PM
reames requested review of this revision.Mar 17 2021, 12:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 17 2021, 12:46 PM
mkazantsev added a comment.EditedMar 18 2021, 10:10 PM

Is there any difference between this "near recurrence" and any loop-variant value? Like, in code

iv = phi 0, iv.next
x = load volatile ...
iv.next = iv + x

iv is near-recurrence in your definition. But what is a conceptual difference between iv and x? Both change on every loop iteration by a random value (or maybe don't change). They even may happen to be the same most of the time.

If you think that "near recurrences" have to be a specific class of loop variants, then we need clear definition of that is it and what properties it is expected to have.

Just from the backedge value beng a binop, I don't think we can derive any useful properties.

reames abandoned this revision.Mar 22 2021, 11:36 AM

Subsumed by comment change to header.

Max, on your example, consider the case where the volatile load has range metadata. Just because we have a loop varying value does not mean we know nothing about it.