-
- 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 (get_irn_visited(arg) < visited_nr)
+ sub_res = be_spill_phi(senv, arg, ctx_irn, visited_nr, already_visited_phis);
+ 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?!?");
+ }
+ }