Skip cast nodes for the tail call check. (#11986)
authorSergey Andreenko <seandree@microsoft.com>
Tue, 30 May 2017 23:02:20 +0000 (16:02 -0700)
committerGitHub <noreply@github.com>
Tue, 30 May 2017 23:02:20 +0000 (16:02 -0700)
Fix #11983

src/jit/morph.cpp

index 0608dcd..b8c269c 100644 (file)
@@ -8137,8 +8137,16 @@ GenTreePtr Compiler::fgMorphCall(GenTreeCall* call)
             if (stmtExpr->gtOper == GT_ASG && info.compRetType != TYP_VOID)
             {
                 noway_assert(stmtExpr->gtGetOp1()->OperIsLocal());
+
+                GenTreePtr treeWithLcl = retExpr->gtGetOp1();
+                while (treeWithLcl->gtOper == GT_CAST)
+                {
+                    noway_assert(!treeWithLcl->gtOverflow());
+                    treeWithLcl = treeWithLcl->gtGetOp1();
+                }
+
                 noway_assert(stmtExpr->gtGetOp1()->AsLclVarCommon()->gtLclNum ==
-                             retExpr->gtGetOp1()->AsLclVarCommon()->gtLclNum);
+                             treeWithLcl->AsLclVarCommon()->gtLclNum);
             }
 
             fgRemoveStmt(compCurBB, nextMorphStmt);