This is an archive of the discontinued LLVM Phabricator instance.

[GraphTraits] Make nodes_iterator dereference to NodeType*
ClosedPublic

Authored by timshen on Aug 18 2016, 10:27 PM.

Details

Summary

Currently nodes_iterator may dereference to a NodeType* or a NodeType&. Make them all dereference to NodeType*, which is NodeRef later.

Diff Detail

Event Timeline

timshen updated this revision to Diff 68648.Aug 18 2016, 10:27 PM
timshen retitled this revision from to [GraphTraits] Make nodes_iterator dereference to NodeType*.
timshen updated this object.
timshen added a reviewer: dblaikie.
timshen added a subscriber: llvm-commits.
dblaikie accepted this revision.Aug 19 2016, 10:29 AM
dblaikie edited edge metadata.
dblaikie added inline comments.
include/llvm/Analysis/CallGraph.h
463–500

Same sort of feedback I gave on the equivalent code in Clang (why does the code in Clang look /so/ much the same & could we make some of it common?): A follow up commit to drop the "DerefFun" noise now that we can use decltype, etc.

This revision is now accepted and ready to land.Aug 19 2016, 10:29 AM
timshen closed this revision.Aug 19 2016, 2:29 PM

Landed as r279326.

dberlin added inline comments.
lib/Transforms/Scalar/NaryReassociate.cpp
212

This is actually not preorder :)
It's depth first.

and could be replaced with the depth first iterator

lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
1155

Ditto, this is just depth_first, and should use that.

lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
680

This whole glop is just a fancy way of saying:

for (const auto *Node : depth_first(DT)) { allocateCandidatesAndFindBasis(I->getBlock()); }

I'll fix it if you don't :)