From 3f1aeaa2d552e6e31c13a3b0b2f69662cf04813e Mon Sep 17 00:00:00 2001 From: Li Tian Date: Wed, 11 Jan 2017 14:48:20 -0800 Subject: [PATCH] use assert insteaf of if statement Commit migrated from https://github.com/dotnet/coreclr/commit/3d5e08f057970ee07327a86fea34ecce95574f97 --- src/coreclr/src/jit/codegencommon.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/coreclr/src/jit/codegencommon.cpp b/src/coreclr/src/jit/codegencommon.cpp index b0f4dc2..1e02280 100644 --- a/src/coreclr/src/jit/codegencommon.cpp +++ b/src/coreclr/src/jit/codegencommon.cpp @@ -10701,22 +10701,20 @@ void CodeGen::genRestoreCalleeSavedFltRegs(unsigned lclFrameSize) void CodeGen::genVzeroupperIfNeeded(bool check256bitOnly /* = true*/) { #ifdef FEATURE_AVX_SUPPORT - if (compiler->getSIMDInstructionSet() == InstructionSet_AVX) + bool emitVzeroUpper = false; + if (check256bitOnly) { - if (check256bitOnly) - { - if (getEmitter()->Contains256bitAVX()) - { - instGen(INS_vzeroupper); - } - } - else - { - if (getEmitter()->ContainsAVX()) - { - instGen(INS_vzeroupper); - } - } + emitVzeroUpper = getEmitter()->Contains256bitAVX(); + } + else + { + emitVzeroUpper = getEmitter()->ContainsAVX(); + } + + if (emitVzeroUpper) + { + assert(compiler->getSIMDInstructionSet() == InstructionSet_AVX); + instGen(INS_vzeroupper); } #endif } -- 2.7.4