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

Commit 257758d

Browse files
author
Sven Verdoolaege
committed
prefixSchedule: always return valid schedule
In particular, fail early if no valid schedule can be returned. The caller would not be able to use the invalid schedule anyway.
1 parent 95b5afd commit 257758d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tc/core/polyhedral/schedule_transforms.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,17 @@ isl::union_map partialScheduleImpl(
7373
const ScheduleTree* root,
7474
const ScheduleTree* node,
7575
bool useNode) {
76-
auto schedule = isl::null<isl::union_map>();
7776
auto nodes = node->ancestors(root);
7877
if (useNode) {
7978
nodes.push_back(node);
8079
}
80+
TC_CHECK_GT(nodes.size(), 0u) << "root node does not have a prefix schedule";
81+
auto domain = root->elemAs<ScheduleTreeElemDomain>();
82+
TC_CHECK(domain);
83+
auto schedule = isl::union_map::from_domain(domain->domain_);
8184
for (auto anc : nodes) {
82-
if (auto domainElem = anc->elemAs<ScheduleTreeElemDomain>()) {
83-
schedule = isl::union_map::from_domain(domainElem->domain_);
85+
if (anc->elemAs<ScheduleTreeElemDomain>()) {
86+
TC_CHECK(anc == root);
8487
} else {
8588
schedule = extendSchedule(anc, schedule);
8689
}

0 commit comments

Comments
 (0)