[CODEGEN] Bugfix in prefetch pass (#118)

This commit is contained in:
Philippe Tillet
2021-05-20 22:34:38 -04:00
committed by Philippe Tillet
parent 3ab121dbdb
commit 38ab4e955a
2 changed files with 12 additions and 6 deletions

View File

@@ -95,11 +95,17 @@ void prefetch::run(ir::module &mod) {
});
builder.set_insert_point(bb->get_first_non_phi());
for (ir::instruction *i : loads) {
auto& inst_list = bb->get_inst_list();
for (ir::instruction *i : loads){
auto it = std::find(inst_list.begin(), inst_list.end(), i);
// make sure we don't invalidate insert point
// in case instruction already at the top
if(it == builder.get_insert_point())
continue;
bb->erase(i);
builder.insert(i);
}
}
}
}
} // namespace triton::codegen::transform
} // namespace triton::codegen::transform