[code generation] bugfix in single buffering

This commit is contained in:
Philippe Tillet
2019-03-26 15:55:48 -07:00
parent 8d35c98920
commit 9d6fc1c051
13 changed files with 135 additions and 41 deletions

View File

@@ -21,6 +21,16 @@ bool buffer_info_pass::is_loop_latch(ir::phi_node *phi, ir::value *terminator){
throw std::runtime_error("unreachable");
}
void buffer_info_pass::replace(ir::value* before, ir::value *after) {
shared_.erase(before);
shared_.insert(after);
if(refs_.find(before) != refs_.end()){
ir::value* v = refs_.at(before);
refs_.erase(before);
refs_.insert({after, v});
}
}
void buffer_info_pass::run(ir::module &mod) {
// Find which buffers are shared
for(ir::function *fn: mod.get_function_list())