X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fcfold.c;h=da291f47ab54fe474de156ea760709537c8a0d38;hb=98aa3fd560646d0fac8be990deaa8003e677662a;hp=bdbab4af138913aa18dc4413697e4f7883644ab5;hpb=3f3ef7225cbabdae584723e5d77974d2e1c67d6c;p=mono.git diff --git a/mono/mini/cfold.c b/mono/mini/cfold.c index bdbab4af138..da291f47ab5 100644 --- a/mono/mini/cfold.c +++ b/mono/mini/cfold.c @@ -335,6 +335,19 @@ mono_constant_fold_ins (MonoCompile *cfg, MonoInst *ins, MonoInst *arg1, MonoIns dest->inst_c0 = res; } break; + case OP_COND_EXC_EQ: + res = arg1->inst_c0 == arg2->inst_c0; + if (!res) { + if (overwrite) { + NULLIFY_INS (ins); + NULLIFY_INS (next); + } else { + ALLOC_DEST (cfg, dest, ins); + dest->opcode = OP_ICONST; + dest->inst_c0 = res; + } + } + break; case OP_NOP: case OP_BR: /* This happens when a conditional branch is eliminated */ @@ -348,6 +361,24 @@ mono_constant_fold_ins (MonoCompile *cfg, MonoInst *ins, MonoInst *arg1, MonoIns return NULL; } } + if ((arg1->opcode == OP_PCONST) && (arg2->opcode == OP_PCONST) && ins->next) { + MonoInst *next = ins->next; + + if (next->opcode == OP_LCEQ) { + gboolean res = arg1->inst_p0 == arg2->inst_p0; + if (overwrite) { + NULLIFY_INS (ins); + next->opcode = OP_ICONST; + next->inst_c0 = res; + MONO_INST_NULLIFY_SREGS (next); + } else { + ALLOC_DEST (cfg, dest, ins); + dest->opcode = OP_ICONST; + dest->inst_c0 = res; + } + break; + } + } break; } case OP_FMOVE: