use assert insteaf of if statement
authorLi Tian <litian2025@gmail.com>
Wed, 11 Jan 2017 22:48:20 +0000 (14:48 -0800)
committerLi Tian <litian2025@gmail.com>
Wed, 11 Jan 2017 22:48:20 +0000 (14:48 -0800)
Commit migrated from https://github.com/dotnet/coreclr/commit/3d5e08f057970ee07327a86fea34ecce95574f97

src/coreclr/src/jit/codegencommon.cpp

index b0f4dc2..1e02280 100644 (file)
@@ -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
 }