Disable promotion of custom-layout structs for legacy backend.
authorPat Gavlin <pagavlin@microsoft.com>
Fri, 21 Jul 2017 16:37:59 +0000 (09:37 -0700)
committerPat Gavlin <pagavlin@microsoft.com>
Fri, 21 Jul 2017 16:39:58 +0000 (09:39 -0700)
These kinds of structs--particularly structs with holes--are not handled
correctly by argument morphing on ARM.

Promotion of these kinds of structs was already disabled for the x86
legacy backend; this change disables the optimization  for all legacy
backend targets.

Fixes #12909.

src/jit/lclvars.cpp

index 374f255..a2dcb55 100644 (file)
@@ -1477,14 +1477,13 @@ void Compiler::lvaCanPromoteStructType(CORINFO_CLASS_HANDLE    typeHnd,
 
 #if 1 // TODO-Cleanup: Consider removing this entire #if block in the future
 
-// This method has two callers. The one in Importer.cpp passes sortFields == false
-// and the other passes sortFields == true.
-// This is a workaround that leaves the inlining behavior the same as before while still
-// performing extra struct promotions when compiling the method.
+// This method has two callers. The one in Importer.cpp passes `sortFields == false` and the other passes
+// `sortFields == true`. This is a workaround that leaves the inlining behavior the same as before while still
+// performing extra struct promotion when compiling the method.
 //
-// The x86 legacy back-end can't handle the more general RyuJIT struct promotion (notably structs
-// with holes), in genPushArgList(), so in that case always check for custom layout.
-#if FEATURE_FIXED_OUT_ARGS || !defined(LEGACY_BACKEND)
+// The legacy back-end can't handle this more general struct promotion (notably structs with holes) in
+// morph/genPushArgList()/SetupLateArgs, so in that case always check for custom layout.
+#if !defined(LEGACY_BACKEND)
         if (!sortFields) // the condition "!sortFields" really means "we are inlining"
 #endif
         {