From 5783c29cc004681c93209feed522ee4b7deae461 Mon Sep 17 00:00:00 2001 From: Pat Gavlin Date: Mon, 7 Aug 2017 17:05:46 -0700 Subject: [PATCH] Fix VSO 475427. 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/jit/regalloc.cpp b/src/jit/regalloc.cpp index e522c00..a607040 100644 --- a/src/jit/regalloc.cpp +++ b/src/jit/regalloc.cpp @@ -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 -- 2.7.4