From d513e316e1a5f5e8e482193c736e90d51aba1f88 Mon Sep 17 00:00:00 2001 From: Konstantin Baladurin Date: Mon, 18 Jun 2018 15:49:40 +0300 Subject: [PATCH] [JIT/ARM] Fix Compiler::lvaFrameAddress Use sp-based offset only if r10 reserved or offset is lower than encoding limit. --- src/jit/compiler.hpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp index 51c0299..f0c7449 100644 --- a/src/jit/compiler.hpp +++ b/src/jit/compiler.hpp @@ -2438,7 +2438,7 @@ inline int actualOffset = (spOffset + addrModeOffset); int ldrEncodeLimit = (varTypeIsFloating(type) ? 0x3FC : 0xFFC); // Use ldr sp imm encoding. - if (lvaDoneFrameLayout == FINAL_FRAME_LAYOUT || opts.MinOpts() || (actualOffset <= ldrEncodeLimit)) + if (opts.MinOpts() || (actualOffset <= ldrEncodeLimit)) { offset = spOffset; *pBaseReg = compLocallocUsed ? REG_SAVED_LOCALLOC_SP : REG_SPBASE; @@ -2448,17 +2448,14 @@ inline { *pBaseReg = REG_FPBASE; } - // Use a single movw. prefer locals. - else if (actualOffset <= 0xFFFC) // Fix 383910 ARM ILGEN + // Otherwise, use SP. This is either (1) a small positive offset using a single movw, (2) + // a large offset using movw/movt. In either case, we must have already reserved + // the "reserved register". + else { offset = spOffset; *pBaseReg = compLocallocUsed ? REG_SAVED_LOCALLOC_SP : REG_SPBASE; } - // Use movw, movt. - else - { - *pBaseReg = REG_FPBASE; - } } } else -- 2.7.4