This is an archive of the discontinued LLVM Phabricator instance.

[ADT][NFC] SCCIterator: Change hasLoop() to hasCycle()
ClosedPublic

Authored by baziotis on Feb 18 2020, 3:15 PM.

Details

Summary

hasLoop() seems to be a misleading name in that the user may think that it checks if the SCC contains a loop that satisfies
the criteria of the loop terminology (i.e. a normal loop).

Diff Detail

Event Timeline

baziotis created this revision.Feb 18 2020, 3:15 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 18 2020, 3:15 PM
jdoerfert retitled this revision from [ADT] SCCIterator: Change hasLoop() to hasCycle() to [ADT][NFC] SCCIterator: Change hasLoop() to hasCycle().
efriedma accepted this revision.Feb 18 2020, 3:27 PM

Seems fine.

This revision is now accepted and ready to land.Feb 18 2020, 3:27 PM

Seems fine.

Great, thanks and to @jdoerfert!
Any way I can find the correct reviewers next time?

While i certainly agree that it's kinda confusing, i'm not really sure this is conceptually correct change.
https://en.wikipedia.org/wiki/Loop_(graph_theory)

In graph theory, a loop (also called a self-loop or a "buckle") is an edge that connects a vertex to itself. A simple graph contains no loops.

which is exactly the case here.

https://en.wikipedia.org/wiki/Cycle_(graph_theory)
seems more generic than that.

lebedev.ri added inline comments.Feb 18 2020, 3:33 PM
llvm/tools/opt/PrintSCC.cpp
82–83

err, i was specifically talking about this

104–105

And this

baziotis marked an inline comment as done.Feb 18 2020, 3:38 PM

While i certainly agree that it's kinda confusing, i'm not really sure this is conceptually correct change.
https://en.wikipedia.org/wiki/Loop_(graph_theory)

In graph theory, a loop (also called a self-loop or a "buckle") is an edge that connects a vertex to itself. A simple graph contains no loops.

which is exactly the case here.

https://en.wikipedia.org/wiki/Cycle_(graph_theory)
seems more generic than that.

Yes, I agree, but it was the closest word I could find that is not "loop" but still gets the point across. I mean technically maybe the better term would be "hasALoopButNotNecessarilyANormalLoop()" but well... :P
In any case, that was an experience of mine as a newcomer. If you think it's not worth it, so be it. :)

llvm/tools/opt/PrintSCC.cpp
82–83

Maybe we can keep the "Has self-loop here".

lebedev.ri added inline comments.Feb 18 2020, 3:40 PM
llvm/tools/opt/PrintSCC.cpp
82–83

Then this would look good to me

baziotis marked an inline comment as done.Feb 18 2020, 3:44 PM
baziotis added inline comments.
llvm/tools/opt/PrintSCC.cpp
82–83

Ok, uploading new diff in a bit.

baziotis updated this revision to Diff 245295.Feb 18 2020, 3:55 PM
baziotis edited the summary of this revision. (Show Details)

Self-cycle to self-loop

lg

Great! Just a note: I don't have commit access.

lattner accepted this revision.Feb 27 2020, 9:13 PM

Seems fine to me.

Seems fine to me.

Thank you! Please note that I don't have commit access.

I'd be happy to help fix that problem. Please take a look at the llvm developer policy. :-)

I'd be happy to help fix that problem. Please take a look at the llvm developer policy. :-)

Oh thanks, I thought I had to submit way more patches.

I committed that (https://reviews.llvm.org/rG21390eab4c05e0ed7e7d13ada9e85f62b87ea484) but as it seems, I should have added the differential division in the commit message. I'll try the next commit to be better.

Meinersbur closed this revision.Mar 1 2020, 12:47 PM
Meinersbur added a subscriber: Meinersbur.

I committed that (https://reviews.llvm.org/rG21390eab4c05e0ed7e7d13ada9e85f62b87ea484) but as it seems, I should have added the differential division in the commit message. I'll try the next commit to be better.

If that happens, this Phabricator review does not close automatically. It has to be closed manually using the "Add Action..." dropdown.

If that happens, this Phabricator review does not close automatically. It has to be closed manually using the "Add Action..." dropdown.

Noted.