Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid redundant scope lookups #8103

Merged
merged 5 commits into from
Feb 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix unintentional mutation of interval in scope
  • Loading branch information
abadams committed Feb 19, 2024
commit 1f8c8b5274db789939c44fa94f13897fd065aa1a
9 changes: 5 additions & 4 deletions src/LowerWarpShuffles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,11 @@ class LowerWarpShuffles : public IRMutator {
if ((lt && equal(lt->a, this_lane) && is_const(lt->b)) ||
(le && equal(le->a, this_lane) && is_const(le->b))) {
Expr condition = mutate(op->condition);
Interval *interval = bounds.shallow_find(this_lane_name);
internal_assert(interval);
interval->max = lt ? simplify(lt->b - 1) : le->b;
ScopedBinding<Interval> bind(bounds, this_lane_name, *interval);
const Interval *in = bounds.find(this_lane_name);
internal_assert(in);
Interval interval = *in;
interval.max = lt ? simplify(lt->b - 1) : le->b;
ScopedBinding<Interval> bind(bounds, this_lane_name, interval);
Stmt then_case = mutate(op->then_case);
Stmt else_case = mutate(op->else_case);
return IfThenElse::make(condition, then_case, else_case);
Expand Down
Loading