X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fopt_inline.c;h=eb013651f9cb5838d16214bb56105a5548014613;hb=6b124543aff56817fcfe6d5b5ff181ac5c790e73;hp=a86020d659b2b1292f2f1067eb7057a19a241516;hpb=2bc2dd4bd4f64982e9c5d2f1ea70d63d0eb10044;p=libfirm diff --git a/ir/opt/opt_inline.c b/ir/opt/opt_inline.c index a86020d65..eb013651f 100644 --- a/ir/opt/opt_inline.c +++ b/ir/opt/opt_inline.c @@ -1285,12 +1285,17 @@ typedef struct _inline_env_t { * * @param call the call node */ -static ir_graph *get_call_called_irg(ir_node *call) { +static ir_graph *get_call_called_irg(ir_node *call) +{ ir_node *addr; addr = get_Call_ptr(call); if (is_Global(addr)) { ir_entity *ent = get_Global_entity(addr); + /* we don't know which function gets finally bound to a weak symbol */ + if (get_entity_linkage(ent) & IR_LINKAGE_WEAK) + return NULL; + return get_entity_irg(ent); } @@ -1357,8 +1362,7 @@ void inline_small_irgs(ir_graph *irg, int size) { ir_graph *callee = entry->callee; irg_inline_property prop = get_irg_inline_property(callee); - if (prop == irg_inline_forbidden || get_irg_additional_properties(callee) & mtp_property_weak) { - /* do not inline forbidden / weak graphs */ + if (prop == irg_inline_forbidden) { continue; } @@ -1636,8 +1640,7 @@ void inline_leave_functions(unsigned maxsize, unsigned leavesize, callee = entry->callee; prop = get_irg_inline_property(callee); - if (prop == irg_inline_forbidden || get_irg_additional_properties(callee) & mtp_property_weak) { - /* do not inline forbidden / weak graphs */ + if (prop == irg_inline_forbidden) { continue; } @@ -1691,8 +1694,7 @@ void inline_leave_functions(unsigned maxsize, unsigned leavesize, callee = entry->callee; prop = get_irg_inline_property(callee); - if (prop == irg_inline_forbidden || get_irg_additional_properties(callee) & mtp_property_weak) { - /* do not inline forbidden / weak graphs */ + if (prop == irg_inline_forbidden) { continue; } @@ -1995,7 +1997,7 @@ static int calc_inline_benefice(call_entry *entry, ir_graph *callee) return entry->benefice = INT_MIN; } - if (get_irg_additional_properties(callee) & (mtp_property_noreturn | mtp_property_weak)) { + if (get_irg_additional_properties(callee) & mtp_property_noreturn) { DB((dbg, LEVEL_2, "In %+F Call to %+F: not inlining noreturn or weak\n", call, callee)); return entry->benefice = INT_MIN; @@ -2048,7 +2050,7 @@ static int calc_inline_benefice(call_entry *entry, ir_graph *callee) callee_env = get_irg_link(callee); if (callee_env->n_callers == 1 && callee != current_ir_graph && - (get_entity_linkage(ent) & IR_LINKAGE_LOCAL)) { + !entity_is_externally_visible(ent)) { weight += 700; }