This is an archive of the discontinued LLVM Phabricator instance.

CFGDiff: Simplify and generalize over all graph types
ClosedPublic

Authored by dblaikie on Mar 11 2020, 3:59 PM.

Details

Summary

Use GraphTraits in the implementation of the GraphDiff's own GraphTraits
so GraphDiff can be used across all graph types that provide
GraphTraits.

Also use partial template specializations to make the traits a bit more
compact.

(I wonder if the special handling of inverted graphs can be avoided - it
adds more variations to this code than might be ideal - what's to stop
GraphDiff from not knowing anything about inversion and only using the
Inverse<T> traits to create inverses instead?)

Diff Detail

Event Timeline

dblaikie created this revision.Mar 11 2020, 3:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2020, 3:59 PM

Thanks a lot for this clean-up! I wanted to merge these since I defined them, but couldn't figure out how to do it; this is excellent! :-).

llvm/include/llvm/IR/CFGDiff.h
160

Now that the two classes are merged, could this be called CFGViewChildren?

dblaikie updated this revision to Diff 249799.Mar 11 2020, 4:43 PM

Rename CFGViewSuccessors to CFGViewChildren

dblaikie marked 2 inline comments as done.Mar 11 2020, 4:44 PM

(also fixed the formatting issues the linter picked up)

llvm/include/llvm/IR/CFGDiff.h
160

Yeah, for sure! - updated to include that rename.

asbirlea accepted this revision.Mar 11 2020, 5:17 PM

Thank you, again!

This revision is now accepted and ready to land.Mar 11 2020, 5:17 PM
This revision was automatically updated to reflect the committed changes.
dblaikie marked an inline comment as done.