@@ -9823,20 +9823,42 @@ interp_super_instructions (TransformData *td)
9823
9823
gboolean negate = opcode == MINT_BRFALSE_I4 ;
9824
9824
int cond_sreg = ins -> sregs [0 ];
9825
9825
InterpInst * def = td -> locals [cond_sreg ].def ;
9826
- if (def != NULL ) {
9826
+ if (def != NULL && local_ref_count [ cond_sreg ] == 1 ) {
9827
9827
int replace_opcode = -1 ;
9828
9828
switch (def -> opcode ) {
9829
9829
case MINT_CEQ_I4 : replace_opcode = negate ? MINT_BNE_UN_I4 : MINT_BEQ_I4 ; break ;
9830
9830
case MINT_CEQ_I8 : replace_opcode = negate ? MINT_BNE_UN_I8 : MINT_BEQ_I8 ; break ;
9831
+ case MINT_CGT_I4 : replace_opcode = negate ? MINT_BLE_I4 : MINT_BGT_I4 ; break ;
9832
+ case MINT_CGT_I8 : replace_opcode = negate ? MINT_BLE_I8 : MINT_BGT_I8 ; break ;
9833
+ case MINT_CLT_I4 : replace_opcode = negate ? MINT_BGE_I4 : MINT_BLT_I4 ; break ;
9834
+ case MINT_CLT_I8 : replace_opcode = negate ? MINT_BGE_I8 : MINT_BLT_I8 ; break ;
9835
+ case MINT_CGT_UN_I4 : replace_opcode = negate ? MINT_BLE_UN_I4 : MINT_BGT_UN_I4 ; break ;
9836
+ case MINT_CGT_UN_I8 : replace_opcode = negate ? MINT_BLE_UN_I8 : MINT_BGT_UN_I8 ; break ;
9837
+ case MINT_CLT_UN_I4 : replace_opcode = negate ? MINT_BGE_UN_I4 : MINT_BLT_UN_I4 ; break ;
9838
+ case MINT_CLT_UN_I8 : replace_opcode = negate ? MINT_BGE_UN_I8 : MINT_BLT_UN_I8 ; break ;
9839
+ case MINT_CEQ_R4 : replace_opcode = negate ? MINT_BNE_UN_R4 : MINT_BEQ_R4 ; break ;
9840
+ case MINT_CEQ_R8 : replace_opcode = negate ? MINT_BNE_UN_R8 : MINT_BEQ_R8 ; break ;
9841
+ case MINT_CGT_R4 : replace_opcode = negate ? MINT_BLE_UN_R4 : MINT_BGT_R4 ; break ;
9842
+ case MINT_CGT_R8 : replace_opcode = negate ? MINT_BLE_UN_R8 : MINT_BGT_R8 ; break ;
9843
+ case MINT_CLT_R4 : replace_opcode = negate ? MINT_BGE_UN_R4 : MINT_BLT_R4 ; break ;
9844
+ case MINT_CLT_R8 : replace_opcode = negate ? MINT_BGE_UN_R8 : MINT_BLT_R8 ; break ;
9845
+ case MINT_CGT_UN_R4 : replace_opcode = negate ? MINT_BLE_R4 : MINT_BGT_UN_R4 ; break ;
9846
+ case MINT_CGT_UN_R8 : replace_opcode = negate ? MINT_BLE_R8 : MINT_BGT_UN_R8 ; break ;
9847
+ case MINT_CLT_UN_R4 : replace_opcode = negate ? MINT_BGE_R4 : MINT_BLT_UN_R4 ; break ;
9848
+ case MINT_CLT_UN_R8 : replace_opcode = negate ? MINT_BGE_R8 : MINT_BLT_UN_R8 ; break ;
9849
+ case MINT_CEQ0_I4 : replace_opcode = negate ? MINT_BRTRUE_I4 : MINT_BRFALSE_I4 ; break ; // If def->opcode is MINT_CEQ0_I4 ins->opcode is inverted
9831
9850
// Add more opcodes
9832
9851
default :
9833
9852
break ;
9834
9853
}
9835
9854
if (replace_opcode != -1 ) {
9836
9855
ins -> opcode = replace_opcode ;
9837
9856
ins -> sregs [0 ] = def -> sregs [0 ];
9838
- ins -> sregs [1 ] = def -> sregs [1 ];
9857
+ if (def -> opcode != MINT_CEQ0_I4 )
9858
+ ins -> sregs [1 ] = def -> sregs [1 ];
9839
9859
interp_clear_ins (def );
9860
+ local_ref_count [cond_sreg ]-- ;
9861
+ mono_interp_stats .super_instructions ++ ;
9840
9862
if (td -> verbose_level ) {
9841
9863
g_print ("superins: " );
9842
9864
dump_interp_inst (ins );
0 commit comments