GetSubGraph is a new ScheduleDAG function to get the
subgraph of nodes between two SUs.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
This patch is required for https://reviews.llvm.org/D30152
I don't know who should be reviewer for this code. Anyone ?
Can you please post this patch with full context? See http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface for instructions.
This seems reasonable to me. Hopefully the linker will strip utilities like this for build targets that don't need them.
include/llvm/CodeGen/ScheduleDAG.h | ||
---|---|---|
718 | Do not repeat the function name in the doxygen comment. | |
723–724 | Use references instead of pointers for things that cannot be nullptr. | |
lib/CodeGen/ScheduleDAG.cpp | ||
579 | Better use SUnit::isBoundaryNode() | |
587 | Isn't there a mismatch here? I would assume you either test+set visited at the beginning of the loop or you do both when inserting into the worklist. Testing before insertion but only setting the visited flag when pulling out of the worklist can lead to situations in which elements are pulled out multiple times. | |
611 | Better use SUnit::isBoundaryNode() |
Small comment about the assert, but otherwise LGTM too.
lib/CodeGen/ScheduleDAG.cpp | ||
---|---|---|
624 | This assert should have a comment, but instead of tracking Found again, maybe it would be even better to do this: assert(VisitedBack.size() == Visited.size() && "Did not collect all subgraph nodes?"); |
lib/CodeGen/ScheduleDAG.cpp | ||
---|---|---|
579 | Thanks, I update the diff with that. | |
587 | Right, it sounds better to set Visited directly there. It may be possible without it items get added several times to the WorkList, though the second time the items would be pulled, the operation would be noop. | |
624 | Thanks, I add a comment in the assert. However please note that VisitedBack and Visited likely don't have the same size. |
include/llvm/CodeGen/ScheduleDAG.h | ||
---|---|---|
723 | Isn't it enough to return empty vector on failure, without error flag? |
include/llvm/CodeGen/ScheduleDAG.h | ||
---|---|---|
723 | Empty vector currently means that TargetSU is a direct successor for StartSU. If we don't have error flag and say that a failure return empty vector, I think it's better having directly an error flag. |
Do not repeat the function name in the doxygen comment.