* tree-ssa-opfinalize.h (FINALIZE_FUNC): When creating new nodes, Add calls to FINALIZE_CHECK_MAYDEF_LIST if it is defined. (FINALIZE_CHECK_MAYDEF_LIST): Undefine. * tree-ssa-operands.c (check_maydef_list): New. Check for maydefs which have become mustdefs. (FINALIZE_CHECK_MAYDEF_LIST): Define. Index: tree-ssa-opfinalize.h =================================================================== *** tree-ssa-opfinalize.h (revision 110135) --- tree-ssa-opfinalize.h (working copy) *************** FINALIZE_FUNC (tree stmt) *** 112,117 **** --- 112,120 ---- FINALIZE_INITIALIZE (ptr, FINALIZE_OPBUILD_ELEM (new_i), stmt); last->next = ptr; last = ptr; + #ifdef FINALIZE_CHECK_MAYDEF_LIST + FINALIZE_CHECK_MAYDEF_LIST (ptr, stmt); + #endif new_i++; } if (old_ops) *************** FINALIZE_FUNC (tree stmt) *** 125,130 **** --- 128,136 ---- FINALIZE_INITIALIZE (ptr, FINALIZE_OPBUILD_ELEM (new_i), stmt); last->next = ptr; last = ptr; + #ifdef FINALIZE_CHECK_MAYDEF_LIST + FINALIZE_CHECK_MAYDEF_LIST (ptr, stmt); + #endif } last->next = NULL; *************** FINALIZE_FUNC (tree stmt) *** 172,174 **** --- 178,181 ---- #undef FINALIZE_OPBUILD_BASE #undef FINALIZE_BASE_ZERO #undef FINALIZE_CORRECT_USE + #undef FINALIZE_CHECK_MAYDEF_LIST Index: tree-ssa-operands.c =================================================================== *** tree-ssa-operands.c (revision 110135) --- tree-ssa-operands.c (working copy) *************** finalize_ssa_vuses (tree stmt) *** 592,597 **** --- 592,634 ---- } + + /* When a new mustdef is created, check the maydef list to see if there was + a maydef stmt which may have been changed to a mustdef. */ + + static void + check_maydef_list (struct mustdef_optype_d *ptr, tree stmt) + { + tree var = ptr->def_var; + struct maydef_optype_d *maydef, *last; + + /* A new mustdef cannot be an SSA_NAME. */ + gcc_assert (TREE_CODE (var) == VAR_DECL); + + /* If the decl isn't in the may_def list, simply return. */ + if (!get_var_ann (var)->in_v_may_def_list) + return; + + /* Find the maydef and change the must-def's operands to match. remove the + maydef. */ + + last = NULL; + for (maydef = MAYDEF_OPS (stmt); maydef; last = maydef, maydef = maydef->next) + { + tree v2 = maydef->def_var; + if (TREE_CODE (v2) == SSA_NAME && SSA_NAME_VAR (v2) == var) + { + /* This is a matching SSA_NAME, so copy the vars to the mustdef. */ + ptr->def_var = maydef->def_var; + ptr->kill_var = maydef->use_var; + /* And update the immuse links so it stays in the same place. */ + delink_imm_use (&(ptr->use_ptr)); + relink_imm_use (&(ptr->use_ptr), &(maydef->use_ptr)); + } + } + + + } /* Return a new v_must_def operand vector for STMT, comparing to OLD_OPS_P. */ #define FINALIZE_OPBUILD build_v_must_defs *************** finalize_ssa_vuses (tree stmt) *** 609,614 **** --- 646,652 ---- #define FINALIZE_BASE_ZERO 0 #define FINALIZE_BASE(VAR) get_name_decl (VAR) #define FINALIZE_BASE_TYPE unsigned + #define FINALIZE_CHECK_MAYDEF_LIST check_maydef_list #define FINALIZE_INITIALIZE(PTR, VAL, STMT) \ (PTR)->def_var = (VAL); \ (PTR)->kill_var = (VAL); \