diff --git a/lib/codegen/transform/coalesce.cc b/lib/codegen/transform/coalesce.cc index 0f9675b5b..64af407e5 100644 --- a/lib/codegen/transform/coalesce.cc +++ b/lib/codegen/transform/coalesce.cc @@ -116,8 +116,11 @@ void coalesce::run(ir::module &mod) { // update list of values to rematerialize if(axes.empty()) continue; - for(auto it = ++axes.rbegin(); it != axes.rend(); it++) + for(auto it = ++axes.rbegin(); it != axes.rend(); it++){ + if(it->second.size() == 1) + continue; remat.insert(remat.begin(), it->second.begin(), it->second.end()); + } } // rematerialize values for(ir::io_inst *r: remat) {