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 ↗ | (On Diff #91058) | Do not repeat the function name in the doxygen comment. |
723–724 ↗ | (On Diff #91058) | Use references instead of pointers for things that cannot be nullptr. |
lib/CodeGen/ScheduleDAG.cpp | ||
579 ↗ | (On Diff #91058) | Better use SUnit::isBoundaryNode() |
587 ↗ | (On Diff #91058) | 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 ↗ | (On Diff #91058) | Better use SUnit::isBoundaryNode() |
Small comment about the assert, but otherwise LGTM too.
lib/CodeGen/ScheduleDAG.cpp | ||
---|---|---|
624 ↗ | (On Diff #91769) | 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 | ||
---|---|---|
624 ↗ | (On Diff #91769) | Thanks, I add a comment in the assert. However please note that VisitedBack and Visited likely don't have the same size. |
579 ↗ | (On Diff #91058) | Thanks, I update the diff with that. |
587 ↗ | (On Diff #91058) | 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. |
include/llvm/CodeGen/ScheduleDAG.h | ||
---|---|---|
723 ↗ | (On Diff #91778) | Isn't it enough to return empty vector on failure, without error flag? |
include/llvm/CodeGen/ScheduleDAG.h | ||
---|---|---|
723 ↗ | (On Diff #91778) | 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. |