X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Ffunccall.c;h=256e32c0752a8ae06c3efb7842853c943985ba03;hb=b27ae245166bb695bc4e418ff416d91bc37d0f28;hp=d7f5b59c689db19baf14fffd10053314c9952cfb;hpb=eebab16e6be8c73ebb7cb01d04567136f36b7337;p=libfirm diff --git a/ir/opt/funccall.c b/ir/opt/funccall.c index d7f5b59c6..256e32c07 100644 --- a/ir/opt/funccall.c +++ b/ir/opt/funccall.c @@ -225,7 +225,7 @@ static void fix_const_call_lists(ir_graph *irg, env_t *ctx) } case pn_Call_X_except: exc_changed = 1; - exchange(proj, get_irg_bad(irg)); + exchange(proj, new_r_Bad(irg, mode_X)); break; case pn_Call_X_regular: { ir_node *block = get_nodes_block(call); @@ -239,7 +239,6 @@ static void fix_const_call_lists(ir_graph *irg, env_t *ctx) } /* changes were done ... */ - set_irg_outs_inconsistent(irg); set_irg_loopinfo_state(irg, loopinfo_cf_inconsistent); if (exc_changed) { @@ -360,7 +359,7 @@ static void fix_nothrow_call_list(ir_graph *irg, ir_node *call_list, ir_node *pr switch (get_Proj_proj(proj)) { case pn_Call_X_except: exc_changed = 1; - exchange(proj, get_irg_bad(irg)); + exchange(proj, new_r_Bad(irg, mode_X)); break; case pn_Call_X_regular: { ir_node *block = get_nodes_block(call); @@ -374,7 +373,6 @@ static void fix_nothrow_call_list(ir_graph *irg, ir_node *call_list, ir_node *pr } /* changes were done ... */ - set_irg_outs_inconsistent(irg); set_irg_loopinfo_state(irg, loopinfo_cf_inconsistent); if (exc_changed) { @@ -467,12 +465,10 @@ static mtp_additional_properties follow_mem_(ir_node *node) ir_entity *ent = get_SymConst_entity(ptr); ir_graph *irg = get_entity_irg(ent); - if (irg == get_irn_irg(node)) { - /* A self-recursive call. The property did not depend on this call. */ - } else if (irg == NULL) { + if (irg == NULL) { m = get_entity_additional_properties(ent) & (mtp_property_const|mtp_property_pure); mode = max_property(mode, m); - } else if (irg != NULL) { + } else { /* we have a graph, analyze it. */ m = check_const_or_pure_function(irg, /*top=*/0); mode = max_property(mode, m); @@ -528,9 +524,10 @@ static mtp_additional_properties check_const_or_pure_function(ir_graph *irg, int return mtp_no_property; } if (IS_IRG_BUSY(irg)) { - /* we are still evaluate this method. Be optimistic, - return the best possible so far but mark the result as temporary. */ - return mtp_temporary | mtp_property_const; + /* We are still evaluate this method. + * The function (indirectly) calls itself and thus may not terminate. + */ + return mtp_no_property; } SET_IRG_BUSY(irg); @@ -590,17 +587,13 @@ static mtp_additional_properties check_const_or_pure_function(ir_graph *irg, int } } - if (prop != mtp_no_property) { - if (top || (prop & mtp_temporary) == 0) { - /* We use the temporary flag here to mark optimistic result. - Set the property only if we are sure that it does NOT base on - temporary results OR if we are at top-level. */ - add_irg_additional_properties(irg, prop & ~mtp_temporary); - SET_IRG_READY(irg); + if (top) { + /* Set the property only if we are at top-level. */ + if (prop != mtp_no_property) { + add_irg_additional_properties(irg, prop); } - } - if (top) SET_IRG_READY(irg); + } CLEAR_IRG_BUSY(irg); ir_free_resources(irg, IR_RESOURCE_IRN_VISITED); return prop;