Allow target of calli to be lowered to ldc.i4
authorSteve MacLean, Qualcomm Datacenter Technologies, Inc <sdmaclea@qti.qualcomm.com>
Fri, 17 Mar 2017 00:01:21 +0000 (00:01 +0000)
committerSteve MacLean, Qualcomm Datacenter Technologies, Inc <sdmaclea@qti.qualcomm.com>
Thu, 6 Apr 2017 00:47:36 +0000 (00:47 +0000)
Commit migrated from https://github.com/dotnet/coreclr/commit/e7d260afa524de441e119e8275bc54b38c6600c8

src/coreclr/src/jit/importer.cpp

index 11e1d47..f2a4d21 100644 (file)
@@ -5658,7 +5658,11 @@ GenTreeCall* Compiler::impImportIndirectCall(CORINFO_SIG_INFO* sig, IL_OFFSETX i
     /* Get the function pointer */
 
     GenTreePtr fptr = impPopStack().val;
-    assert(genActualType(fptr->gtType) == TYP_I_IMPL);
+
+    // The function pointer is typically a sized to match the target pointer size
+    // However, stubgen IL optimization can change LDC.I8 to LDC.I4
+    // See ILCodeStream::LowerOpcode
+    assert(genActualType(fptr->gtType) == TYP_I_IMPL || genActualType(fptr->gtType) == TYP_INT);
 
 #ifdef DEBUG
     // This temporary must never be converted to a double in stress mode,