Address reviewer feedback.
authorRodrigo Kumpera <kumpera@gmail.com>
Fri, 11 Aug 2017 21:53:37 +0000 (14:53 -0700)
committerRodrigo Kumpera <kumpera@gmail.com>
Fri, 11 Aug 2017 21:53:37 +0000 (14:53 -0700)
mono/mini/iltests.il
mono/mini/method-to-ir.c

index eede67eb3df15e168e80491b202bb0f747f639a1..9c33cebac406a0ba1ee222622e53e9032936c99d 100644 (file)
@@ -2902,22 +2902,27 @@ END:
 
     .method public static int32 test_0_implicit_widen_or_local_stores () cil managed 
     {
-               .maxstack 1
+               .maxstack 4
                .locals init (
                        unsigned int8   V_0,
                        int8    V_1,
                        int16   V_2,
                        unsigned int16  V_3)
 
-               ldc.i4 256
+               /*
+               This test verifies that storing an I4 value from the evail stack into a local variable triggers proper widening.
+               The values are picked so storing them have different values depending on the sign'ness of the local variable.
+               */
+               ldc.i4 0x180
                stsfld int32 Tests::byte_val
-               ldc.i4 65536
+               ldc.i4 0x18000
                stsfld int32 Tests::short_val
 
                ldsfld int32 Tests::byte_val
                stloc.0
                ldloc.0
-               brfalse L_0
+               ldc.i4 128 //0x80
+               beq L_0
 
                ldc.i4.1
                ret
@@ -2925,8 +2930,8 @@ L_0:
                ldsfld int32 Tests::byte_val
                stloc.1
                ldloc.1
-               conv.i4
-               brfalse L_1
+               ldc.i4 -128 //-0x80
+               beq L_1
 
                ldc.i4.2
                ret
@@ -2934,7 +2939,8 @@ L_1:
                ldsfld int32 Tests::short_val
                stloc.2
                ldloc.2
-               brfalse L_2
+               ldc.i4 -32768 //-0x8000
+               beq L_2
 
                ldc.i4.3
                ret
@@ -2942,7 +2948,8 @@ L_2:
                ldsfld int32 Tests::short_val
                stloc.3
                ldloc.3
-               brfalse L_3
+               ldc.i4 32768 //0x8000
+               beq L_3
 
                ldc.i4.4
                ret
index 967546007646679f1008dddb62b8e537e6dc420d..48ecab877814e1f11d7d07408830b69fb946a1ed 100644 (file)
@@ -6673,7 +6673,7 @@ emit_stloc_ir (MonoCompile *cfg, MonoInst **sp, MonoMethodHeader *header, int n)
                        ins->sreg1 = sp [0]->dreg;
                        ins->type = STACK_I4;
                        ins->klass = mono_class_from_mono_type (header->locals [n]);
-               MONO_ADD_INS (cfg->cbb, ins);
+                       MONO_ADD_INS (cfg->cbb, ins);
                        *sp = mono_decompose_opcode (cfg, ins);
                }
        }