X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fcfold.c;h=940c07ac8d825b9d0bb3886ec37d35b71319ef41;hb=5d97d9b6c91b8000a356f7cafeeb9747db2b3c9f;hp=a4910feb18003f48f13f6d6a994522daf1039c27;hpb=df9c98dda18083ec63171490267e08342621ef45;p=mono.git diff --git a/mono/mini/cfold.c b/mono/mini/cfold.c index a4910feb180..940c07ac8d8 100644 --- a/mono/mini/cfold.c +++ b/mono/mini/cfold.c @@ -1,5 +1,6 @@ -/* - * cfold.c: Constant folding support +/** + * \file + * Constant folding support * * Author: * Paolo Molaro (lupus@ximian.com) @@ -361,6 +362,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: