Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 73d51b0

Browse files
author
Sven Verdoolaege
committed
ScheduleTree::ancestors: handle case where inputs are equal
The sequence of ancestors of a node within itself is simply the empty sequence. Handling this case in ancestors allows special casing in activeDomainPoints to be removed.
1 parent 315ec26 commit 73d51b0

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

tc/core/polyhedral/schedule_transforms.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ isl::union_set activeDomainPoints(
111111
CHECK(domainElem) << "root must be a Domain node" << *root;
112112

113113
auto domain = domainElem->domain_;
114-
if (root == node) {
115-
return domain;
116-
}
117114

118115
for (auto anc : node->ancestors(root)) {
119116
if (auto filterElem = anc->elemAsBase<ScheduleTreeElemFilter>()) {

tc/core/polyhedral/schedule_tree.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ vector<size_t> positionRelativeToSubtree(
8484
vector<const ScheduleTree*> constAncestorsInSubTree(
8585
const ScheduleTree* relativeRoot,
8686
const ScheduleTree* target) {
87+
if (relativeRoot == target) {
88+
return vector<const ScheduleTree*>();
89+
}
8790
vector<size_t> cp(positionRelativeToSubtree(relativeRoot, target));
8891
if (cp.size() == 0) {
8992
// Special case, this must be the root

tc/core/polyhedral/schedule_tree.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ struct ScheduleTree {
262262
// Returns the ancestors up to relativeRoot in a vector. The first element
263263
// of the result is relativeRoot, the last element of the result is the
264264
// father of the "this" ScheduleTree.
265+
// If relativeRoot is equal to "this" ScheduleTree, then the result is empty.
265266
std::vector<ScheduleTree*> ancestors(ScheduleTree* relativeRoot);
266267
std::vector<const ScheduleTree*> ancestors(
267268
const ScheduleTree* relativeRoot) const;

0 commit comments

Comments
 (0)