arity = mono_burg_arity [inst->opcode];
- if ((inst->ssa_op == MONO_SSA_LOAD || inst->ssa_op == MONO_SSA_MAYBE_LOAD) &&
+ if ((inst->ssa_op == MONO_SSA_LOAD || inst->ssa_op == MONO_SSA_ADDRESS_TAKEN) &&
(inst->inst_i0->opcode == OP_LOCAL || inst->inst_i0->opcode == OP_ARG)) {
MonoInst *new_var;
int idx = inst->inst_i0->inst_c0;
idx = inst->inst_i0->inst_c0;
g_assert (idx < max_vars);
- if (!stack [idx] && bb == cfg->bb_init) {
+ if ((!stack [idx]) && (bb == cfg->bb_init) && (inst->inst_i0->opcode != OP_ARG)) {
new_var = cfg->varinfo [idx];
} else {
new_var = mono_compile_create_var (cfg, inst->inst_i0->inst_vtype, inst->inst_i0->opcode);
arity = mono_burg_arity [inst->opcode];
- if ((inst->ssa_op == MONO_SSA_LOAD || inst->ssa_op == MONO_SSA_MAYBE_LOAD || inst->ssa_op == MONO_SSA_STORE) &&
+ if ((inst->ssa_op == MONO_SSA_LOAD || inst->ssa_op == MONO_SSA_ADDRESS_TAKEN || inst->ssa_op == MONO_SSA_STORE) &&
(inst->inst_i0->opcode == OP_LOCAL || inst->inst_i0->opcode == OP_ARG)) {
MonoInst *new_var;
int idx = inst->inst_i0->inst_c0;
}
}
- if ((inst->ssa_op == MONO_SSA_LOAD || inst->ssa_op == MONO_SSA_MAYBE_LOAD) &&
+ if ((inst->ssa_op == MONO_SSA_LOAD || inst->ssa_op == MONO_SSA_ADDRESS_TAKEN) &&
(inst->inst_i0->opcode == OP_LOCAL || inst->inst_i0->opcode == OP_ARG)) {
MonoVarUsageInfo *ui = mono_mempool_alloc (cfg->mempool, sizeof (MonoVarUsageInfo));
idx = inst->inst_i0->inst_c0;
inst->opcode = CEE_BR;
inst->inst_target_bb = target;
}
- } else if (inst->opcode == CEE_SWITCH && evaluate_const_tree (cfg, inst->inst_left, &a, carray) == 1) {
+ } else if (inst->opcode == CEE_SWITCH && (evaluate_const_tree (cfg, inst->inst_left, &a, carray) == 1) && (a >= 0) && (a < GPOINTER_TO_INT (inst->klass))) {
bb->out_bb [0] = inst->inst_many_bb [a];
bb->out_count = 1;
inst->inst_target_bb = bb->out_bb [0];
if (inst->opcode == CEE_SWITCH) {
int r1, i, a;
+ int cases = GPOINTER_TO_INT (inst->klass);
r1 = evaluate_const_tree (cfg, inst->inst_left, &a, carray);
+ if ((r1 == 1) && ((a < 0) || (a >= cases)))
+ r1 = 2;
if (r1 == 1) {
MonoBasicBlock *tb = inst->inst_many_bb [a];
if (!(tb->flags & BB_REACHABLE)) {
for (i = 0; i < cfg->num_varinfo; i++) {
MonoMethodVar *info = cfg->vars [i];
work_list = g_list_prepend (work_list, info);
+
+ //if ((info->def != NULL) && (info->def->inst_i1->opcode != OP_PHI)) printf ("SSA DEADCE TOTAL LOCAL\n");
}
while (work_list) {
MonoMethodVar *u = cfg->vars [i1->inst_i0->inst_c0];
add_to_dce_worklist (cfg, info, u, &work_list);
}
+ //if (i1->opcode != OP_PHI) printf ("SSA DEADCE DEAD LOCAL\n");
info->def->opcode = CEE_NOP;
info->def->ssa_op = MONO_SSA_NOP;