From 4ed578e0d2307c2d47bd63efb02bd93ca7c33f13 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 12 Jun 2020 01:48:18 +0200 Subject: [PATCH] Clean up EmitSBIT slightly --- src/common/scripting/jit/jit_store.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/common/scripting/jit/jit_store.cpp b/src/common/scripting/jit/jit_store.cpp index a5b2b4fefc..4d0276870b 100644 --- a/src/common/scripting/jit/jit_store.cpp +++ b/src/common/scripting/jit/jit_store.cpp @@ -139,19 +139,21 @@ void JitCompiler::EmitSBIT() { EmitNullPointerThrow(A, X_WRITE_NIL); - IRValue* ptr = LoadA(A); - IRValue* value = cc.CreateLoad(ptr); - IRBasicBlock* ifbb = irfunc->createBasicBlock({}); IRBasicBlock* elsebb = irfunc->createBasicBlock({}); IRBasicBlock* endbb = irfunc->createBasicBlock({}); cc.CreateCondBr(cc.CreateICmpNE(LoadD(B), ConstValueD(0)), ifbb, elsebb); + cc.SetInsertPoint(ifbb); - cc.CreateStore(cc.CreateOr(value, ircontext->getConstantInt(int8Ty, (int)C)), ptr); + IRValue* ptr = LoadA(A); + Store(cc.CreateOr(Load(ptr), ircontext->getConstantInt(int8Ty, (int)C)), ptr); cc.CreateBr(endbb); + cc.SetInsertPoint(elsebb); - cc.CreateStore(cc.CreateAnd(value, ircontext->getConstantInt(int8Ty, ~(int)C)), ptr); + ptr = LoadA(A); + Store(cc.CreateAnd(Load(ptr), ircontext->getConstantInt(int8Ty, ~(int)C)), ptr); cc.CreateBr(endbb); + cc.SetInsertPoint(endbb); }