Skip to content

Commit

Permalink
Check both orders in the range merge function (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
vksnk authored Feb 20, 2025
1 parent 865f766 commit 01e3778
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions builder/pipeline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,11 @@ class pipeline_builder {
std::set<var> allocations;

static statement_with_range merge(const statement_with_range& a, const statement_with_range& b) {
if (a.start > b.end) {
// In case the range order is reversed.
return merge(b, a);
}

assert(a.end + 1 == b.start);
statement_with_range r;
r.body = block::make({a.body, b.body});
Expand Down

0 comments on commit 01e3778

Please sign in to comment.