-
- if(is_Phi(arg) && pset_find_ptr(senv->mem_phis, arg))
- sub_res = be_spill_phi(senv, arg, ctx_irn);
+ phi_spill_assoc_t *entry;
+
+ if(is_Phi(arg) && pset_find_ptr(senv->mem_phis, arg)) {
+ if (! bitset_is_set(bs, get_irn_idx(arg)))
+ sub_res = be_spill_phi(senv, arg, ctx_irn, already_visited_phis, bs);
+ else {
+ /* we already visited the argument phi: get it's spill */
+ key.phi = arg;
+ key.spill = NULL;
+ entry = set_find(already_visited_phis, &key, sizeof(key), HASH_PTR(arg));
+ assert(entry && "argument phi already visited, but no spill found?!?");
+ sub_res = entry->spill;
+ assert(sub_res && "spill missing?!?");
+ }
+ }