Fix VSO 475427.
authorPat Gavlin <pagavlin@microsoft.com>
Tue, 8 Aug 2017 00:05:46 +0000 (17:05 -0700)
committerPat Gavlin <pagavlin@microsoft.com>
Tue, 8 Aug 2017 00:05:46 +0000 (17:05 -0700)
In addition to repredicting if the frame size is large enough to require
that we reserve `r10`, we also need to throw out any previous
prediction. If we do not, we may decide to reuse it if uses less stack
space than the reprediction.

src/jit/regalloc.cpp

index e522c00..a607040 100644 (file)
@@ -6473,12 +6473,16 @@ void Compiler::rpPredictRegUse()
 
 #ifdef _TARGET_ARM_
         // The spill count may be now high enough that we now need to reserve r10. If this is the case, we'll need to
-        // reserve r10, and if it was used, repredict.
+        // reserve r10, and if it was used, throw out the last prediction and repredict.
         if (((codeGen->regSet.rsMaskResvd & RBM_OPT_RSVD) == 0) && compRsvdRegCheck(REGALLOC_FRAME_LAYOUT))
         {
             codeGen->regSet.rsMaskResvd |= RBM_OPT_RSVD;
             allAcceptableRegs &= ~RBM_OPT_RSVD;
-            mustPredict = (regUsed & RBM_OPT_RSVD) != 0;
+            if ((regUsed & RBM_OPT_RSVD) != 0)
+            {
+                mustPredict = true;
+                rpBestRecordedPrediction = nullptr;
+            }
         }
 #endif