Fix struct promotion check for SIMD field (dotnet/coreclr#18548)
authorCarol Eidt <carol.eidt@microsoft.com>
Tue, 19 Jun 2018 20:35:02 +0000 (13:35 -0700)
committerGitHub <noreply@github.com>
Tue, 19 Jun 2018 20:35:02 +0000 (13:35 -0700)
A struct can have `lvIsRegArg` true but have multiple SIMD fields if it is passed by reference.

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

src/coreclr/src/jit/lclvars.cpp

index e0e8f74..b36fcad 100644 (file)
@@ -2011,7 +2011,7 @@ void Compiler::lvaPromoteStructVar(unsigned lclNum, lvaStructPromotionInfo* Stru
             fieldVarDsc->lvArgReg   = varDsc->lvArgReg;
             fieldVarDsc->setPrefReg(varDsc->lvArgReg, this); // Set the preferred register
 #if FEATURE_MULTIREG_ARGS && defined(FEATURE_SIMD)
-            if (varTypeIsSIMD(fieldVarDsc))
+            if (varTypeIsSIMD(fieldVarDsc) && !lvaIsImplicitByRefLocal(lclNum))
             {
                 // This field is a SIMD type, and will be considered to be passed in multiple registers
                 // if the parent struct was. Note that this code relies on the fact that if there is