From 961f24096a9c2bfe4f848c27e0756669042a8985 Mon Sep 17 00:00:00 2001 From: Pat Gavlin Date: Wed, 19 Apr 2017 11:26:46 -0700 Subject: [PATCH] Spill side-effects in impAssignMultiRegTypeToVar. This importer function converts IR from the form tree to /- tree STMT - = \- lclVar in order to conform to the JIT's representation of multi-register values. Today, it does not check whether or not the tree being spilled has any side-effects that may interfere with the side-effects of trees that are already on the evaluation stack, which can lead to bad codegen. This change fixes this function to spill any side-effects on the stack before generating the temp assign. Fixes #10940. --- src/jit/importer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp index e678b15..2e3ca81 100644 --- a/src/jit/importer.cpp +++ b/src/jit/importer.cpp @@ -15051,7 +15051,7 @@ void Compiler::impMarkLclDstNotPromotable(unsigned tmpNum, GenTreePtr src, CORIN GenTreePtr Compiler::impAssignMultiRegTypeToVar(GenTreePtr op, CORINFO_CLASS_HANDLE hClass) { unsigned tmpNum = lvaGrabTemp(true DEBUGARG("Return value temp for multireg return.")); - impAssignTempGen(tmpNum, op, hClass, (unsigned)CHECK_SPILL_NONE); + impAssignTempGen(tmpNum, op, hClass, (unsigned)CHECK_SPILL_ALL); GenTreePtr ret = gtNewLclvNode(tmpNum, op->gtType); // TODO-1stClassStructs: Handle constant propagation and CSE-ing of multireg returns. -- 2.7.4