[gsharedvt] Disable the box+brtrue optimization for gsharedvt types. Fixes #33324.
authorZoltan Varga <vargaz@gmail.com>
Thu, 27 Aug 2015 20:15:01 +0000 (16:15 -0400)
committerZoltan Varga <vargaz@gmail.com>
Thu, 27 Aug 2015 20:15:07 +0000 (16:15 -0400)
mono/mini/gshared.cs
mono/mini/method-to-ir.c

index 2f60cb70210c758dfbc8e718b972814a4115ed3e..f5ee9bbbf6069effddeddeeed2067809a3058226 100644 (file)
@@ -1300,6 +1300,7 @@ public class Tests
 
        interface IFaceBox {
                object box<T> (T t);
+               bool is_null<T> (T t);
        }
 
        class ClassBox : IFaceBox {
@@ -1307,6 +1308,12 @@ public class Tests
                        object o = t;
                        return o;
                }
+
+               public bool is_null<T> (T t) {
+                       if (!(default(T) == null))
+                               return false;
+                       return true;
+               }
        }
 
        public static int test_0_nullable_box () {
@@ -1329,6 +1336,15 @@ public class Tests
                return 0;
        }
 
+       public static int test_0_nullable_box_brtrue_opt () {
+               IFaceBox c = new ClassBox ();
+
+               if (c.is_null<double?> (null))
+                       return 0;
+               else
+                       return 1;
+       }
+
        interface IFaceUnbox2 {
                T unbox<T> (object o);
        }
index 09e4342198182314507ee51c30d1a69eb37d0a7b..b1c38b700076b9186e73838f4a6d20b08b768894 100644 (file)
@@ -10634,6 +10634,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
 
                        // FIXME: LLVM can't handle the inconsistent bb linking
                        if (!mono_class_is_nullable (klass) &&
+                               !mini_is_gsharedvt_klass (klass) &&
                                ip + 5 < end && ip_in_bb (cfg, cfg->cbb, ip + 5) &&
                                (ip [5] == CEE_BRTRUE || 
                                 ip [5] == CEE_BRTRUE_S ||