fix crash with phis with multiple edges from same BB
MODIFY
ir/function.cpp
ir/function.cpp
@@ -163,10 +163,11 @@ const BasicBlock& Function::bbOf(const Instr &i) const {
BasicBlock& Function::insertBBBefore(string_view name, const BasicBlock &bb) {
auto p = BBs.try_emplace(string(name), name);
- assert(p.second);
+ if (p.second) {
auto I = find(BB_order.begin(), BB_order.end(), &bb);
assert(I != BB_order.end());
BB_order.insert(I, &p.first->second);
+ }
return p.first->second;
}

fix crash with phis with multiple edges from same BB