From 15bcac530533bf1bd7ef11ab69103896e468e9c1 Mon Sep 17 00:00:00 2001 From: Vlad Brezae Date: Thu, 1 Aug 2019 15:21:50 +0300 Subject: [PATCH] [mini] Ignore conv.r.un if top of stack is already float (mono/mono#15818) Fixes https://github.com/mono/mono/issues/15794 Commit migrated from https://github.com/mono/mono/commit/ce398411a06b85441611565b9b6119c2702cb284 --- src/mono/mono/mini/iltests.il | 9 +++++++++ src/mono/mono/mini/method-to-ir.c | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/mono/mono/mini/iltests.il b/src/mono/mono/mini/iltests.il index 45a3a0b..063a271 100644 --- a/src/mono/mono/mini/iltests.il +++ b/src/mono/mono/mini/iltests.il @@ -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 diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c index 784f194..ff00d7d 100644 --- a/src/mono/mono/mini/method-to-ir.c +++ b/src/mono/mono/mini/method-to-ir.c @@ -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: -- 2.7.4