taichi/analysis/last_store_or_atomic.cpp
// We don't know if a loop's body will be executed, so we cannot forward
// the "last" store inside a loop to the local load statement.
// What we can do is just check if the loop doesn't modify the variable.
We don't know if a loop's body will be executed, so we cannot forward
the "last" store inside a loop to the local load statement.
What we can do is just check if the loop doesn't modify the variable.
We don ' t know if a loop ' s body will be executed so we cannot forward the " last " store inside a loop to the local load statement . What we can do is just check if the loop doesn ' t modify the variable .
void visit(WhileStmt *stmt) override {
    if (irpass::analysis::has_store_or_atomic(stmt, {var_})) {
      is_valid_ = false;
    }
  }
void visit ( WhileStmt * stmt ) override { if ( irpass :: analysis :: has_store_or_atomic ( stmt , { var_ } ) ) { is_valid_ = false ; } }
We don't know if a loop's body will be executed, so we cannot forward
the "last" store inside a loop to the local load statement.
We don ' t know if a loop ' s body will be executed so we cannot forward the " last " store inside a loop to the local load statement .