Use correct basic block to check legality of PInvoke callsite for inlining (dotnet...
authorJan Kotas <jkotas@microsoft.com>
Sun, 24 Jun 2018 03:20:58 +0000 (20:20 -0700)
committerGitHub <noreply@github.com>
Sun, 24 Jun 2018 03:20:58 +0000 (20:20 -0700)
It is the same logic as used in other similar places

Commit migrated from https://github.com/dotnet/coreclr/commit/eb31c358b27182dae487406a3247dfe995beb40f

src/coreclr/src/jit/importer.cpp

index b236c97..fe30580 100644 (file)
@@ -19061,7 +19061,9 @@ void Compiler::impMarkInlineCandidate(GenTree*               callNode,
 
     if (methAttr & CORINFO_FLG_PINVOKE)
     {
-        if (!impCanPInvokeInlineCallSite(compCurBB))
+        // See comment in impCheckForPInvokeCall
+        BasicBlock* block = compIsForInlining() ? impInlineInfo->iciBlock : compCurBB;
+        if (!impCanPInvokeInlineCallSite(block))
         {
             inlineResult.NoteFatal(InlineObservation::CALLSITE_PINVOKE_EH);
             return;