Commit 2cdc854a authored by Matthias Braun's avatar Matthias Braun
Browse files

scalar_replace: simplify odd is_address_taken() logic

- is_address_taken() according to its own logic was only valid when
  called with a Sel node
- Tuples where skipped although irg_properties ensured no tuples in the
  graph anyway.
- Call and default case could be merged.
- Id case would have failed if taken (is_address_taken called with Id
  instead of Sel)
parent 736af708
......@@ -196,45 +196,14 @@ bool is_address_taken(ir_node *sel)
return true;
/* Check the Sel successor of Sel */
bool res = is_address_taken(succ);
if (res)
if (!is_Sel(succ))
return true;
break;
}
case iro_Call:
/* The address of an entity is given as a parameter.
* As long as we do not have analyses that can tell what
* is done with parameters, think is taken.
* One special case: If the Call type tells that it's a
* value parameter, the address is NOT taken.
*/
return true;
case iro_Id: {
bool res = is_address_taken(succ);
if (res)
return true;
break;
}
case iro_Tuple:
/* Non-optimized Tuple, happens in inlining */
for (int input_nr = get_Tuple_n_preds(succ); input_nr-- > 0; ) {
ir_node *pred = get_Tuple_pred(succ, input_nr);
if (pred != sel)
continue;
/* we found one input */
foreach_irn_out_r(succ, k, proj) {
if (is_Proj(proj) && get_Proj_proj(proj) == input_nr) {
bool res = is_address_taken(proj);
if (res)
return true;
}
}
}
break;
default:
/* another op, the address is taken */
return true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment