Skip to content

Commit

Permalink
Verify that removed expression has no other side effects
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunderberg committed Aug 5, 2022
1 parent 6bc63cb commit 55737e0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/tir/transforms/remove_store_undef.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class StoreUndefLocator : public StmtExprVisitor {
StmtExprVisitor::VisitExpr(op->value);
std::swap(has_undef_, stash_undef);
if (stash_undef) {
ICHECK(SideEffect(op->value) <= CallEffectKind::kReadState)
<< "Error: T.undef() used in BufferStore expressions "
<< "must not have other side effects";
undef_stores_.insert(op);
}
}
Expand All @@ -66,6 +69,9 @@ class StoreUndefLocator : public StmtExprVisitor {
StmtExprVisitor::VisitExpr(op->value);
std::swap(has_undef_, stash_undef);
if (stash_undef) {
ICHECK(SideEffect(op->value) <= CallEffectKind::kReadState)
<< "Error: T.undef() used in Let expressions "
<< "must not have other side effects";
var_bindings_with_undef_.insert(op->var.get());
}

Expand Down

0 comments on commit 55737e0

Please sign in to comment.