Fix intrinsics treatment in Crossgen2
authorTomas <trylek@microsoft.com>
Sun, 19 Jan 2020 21:33:16 +0000 (22:33 +0100)
committerTomas <trylek@microsoft.com>
Thu, 23 Jan 2020 07:45:10 +0000 (08:45 +0100)
This change fixes unintentional differences in the treatment of
intrinsics in Crossgen2 compared to Crossgen1 I found while
investigating failures in the regression test b426654. While the
change by itself doesn't fully fix the test, I believe it to be
generally useful towards removing the remaining codegen
differences between the compilers.

Thanks

Tomas

src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.Intrinsics.cs
src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs

index f42e74a..738856c 100644 (file)
@@ -179,7 +179,7 @@ namespace Internal.JitInterface
             if (pMustExpand != null)
                 *pMustExpand = 0;
 
-            Debug.Assert(method.IsIntrinsic);
+            Debug.Assert(method.IsIntrinsic || method.IsInternalCall);
 
             IntrinsicKey key = new IntrinsicKey();
             key.MethodName = method.Name;
index 48e589d..96f37e2 100644 (file)
@@ -622,8 +622,8 @@ namespace Internal.JitInterface
 
             if (method.IsSynchronized)
                 result |= CorInfoFlag.CORINFO_FLG_SYNCH;
-            if (method.IsIntrinsic)
-                result |= CorInfoFlag.CORINFO_FLG_INTRINSIC | CorInfoFlag.CORINFO_FLG_JIT_INTRINSIC;
+            if (method.IsIntrinsic || method.IsInternalCall)
+                result |= CorInfoFlag.CORINFO_FLG_INTRINSIC;
             if (method.IsVirtual)
                 result |= CorInfoFlag.CORINFO_FLG_VIRTUAL;
             if (method.IsAbstract)
@@ -712,6 +712,11 @@ namespace Internal.JitInterface
                 }
             }
 
+            if (method.HasCustomAttribute("System.Runtime.CompilerServices", "IntrinsicAttribute"))
+            {
+                result |= CorInfoFlag.CORINFO_FLG_JIT_INTRINSIC;
+            }
+
             result |= CorInfoFlag.CORINFO_FLG_NOSECURITYWRAP;
 
             return (uint)result;