Forbid to clone GT_RET_EXPR (#14495)
authorSergey Andreenko <seandree@microsoft.com>
Mon, 16 Oct 2017 15:47:46 +0000 (08:47 -0700)
committerGitHub <noreply@github.com>
Mon, 16 Oct 2017 15:47:46 +0000 (08:47 -0700)
* Forbid to clone GT_RET_EXPR

It potentially creates non-unique trees.

src/jit/gentree.cpp

index bff9c81..422b5d3 100644 (file)
@@ -7395,7 +7395,10 @@ GenTreePtr Compiler::gtCloneExpr(
                 goto DONE;
 
             case GT_RET_EXPR:
-                copy = gtNewInlineCandidateReturnExpr(tree->gtRetExpr.gtInlineCandidate, tree->gtType);
+                // GT_RET_EXPR is unique node, that contains a link to a gtInlineCandidate node,
+                // that is part of another statement. We cannot clone both here and cannot
+                // create another GT_RET_EXPR that points to the same gtInlineCandidate.
+                NO_WAY("Cloning of GT_RET_EXPR node not supported");
                 goto DONE;
 
             case GT_MEMORYBARRIER: