[mini] Ignore conv.r.un if top of stack is already float (mono/mono#15818)
authorVlad Brezae <brezaevlad@gmail.com>
Thu, 1 Aug 2019 12:21:50 +0000 (15:21 +0300)
committerGitHub <noreply@github.com>
Thu, 1 Aug 2019 12:21:50 +0000 (15:21 +0300)
Fixes https://github.com/mono/mono/issues/15794

Commit migrated from https://github.com/mono/mono/commit/ce398411a06b85441611565b9b6119c2702cb284

src/mono/mono/mini/iltests.il
src/mono/mono/mini/method-to-ir.c

index 45a3a0b..063a271 100644 (file)
@@ -3136,6 +3136,15 @@ L_3:
        ret
   }
 
+  .method public hidebysig static int32 test_3_github_issue_15794 () cil managed
+  {
+      .maxstack 8
+      ldc.r8 3.4
+      conv.r.un
+      conv.i4
+      ret
+  }
+
   .method public hidebysig static int32 test_1_box_r8_r4_autoconv () cil managed
   {
                ldc.r8 1.234
index 784f194..ff00d7d 100644 (file)
@@ -1087,6 +1087,9 @@ type_from_op (MonoCompile *cfg, MonoInst *ins, MonoInst *src1, MonoInst *src2)
                case STACK_I8:
                        ins->opcode = OP_LCONV_TO_R_UN; 
                        break;
+               case STACK_R8:
+                       ins->opcode = OP_FMOVE;
+                       break;
                }
                break;
        case MONO_CEE_CONV_OVF_I1: