Replace gtDblCon. with AsDblCon()
authorSinan Kaya <41809318+franksinankaya@users.noreply.github.com>
Mon, 14 Oct 2019 23:01:39 +0000 (16:01 -0700)
committerSergey Andreenko <seandree@microsoft.com>
Mon, 14 Oct 2019 23:01:39 +0000 (16:01 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/bc8c0ec37108eb621596f5251542ddad13f3f326

src/coreclr/src/jit/assertionprop.cpp
src/coreclr/src/jit/codegenarm.cpp
src/coreclr/src/jit/codegenxarch.cpp
src/coreclr/src/jit/gentree.cpp
src/coreclr/src/jit/gentree.h
src/coreclr/src/jit/lsraarm64.cpp
src/coreclr/src/jit/morph.cpp
src/coreclr/src/jit/valuenum.cpp

index cbfb84f7f79568ff9d184893024272edc0e9c997..e46640450b5945ce3f4da57c59cf98757201f5cb 100644 (file)
@@ -1111,11 +1111,11 @@ AssertionIndex Compiler::optCreateAssertion(GenTree*         op1,
                     {
                         noway_assert(op2->gtOper == GT_CNS_DBL);
                         /* If we have an NaN value then don't record it */
-                        if (_isnan(op2->gtDblCon.gtDconVal))
+                        if (_isnan(op2->AsDblCon()->gtDconVal))
                         {
                             goto DONE_ASSERTION; // Don't make an assertion
                         }
-                        assertion.op2.dconVal = op2->gtDblCon.gtDconVal;
+                        assertion.op2.dconVal = op2->AsDblCon()->gtDconVal;
                     }
 
                     //
@@ -2613,7 +2613,7 @@ GenTree* Compiler::optConstantAssertionProp(AssertionDsc* curAssertion,
                 return nullptr;
             }
             newTree->ChangeOperConst(GT_CNS_DBL);
-            newTree->gtDblCon.gtDconVal = curAssertion->op2.dconVal;
+            newTree->AsDblCon()->gtDconVal = curAssertion->op2.dconVal;
             break;
 
         case O2K_CONST_LONG:
@@ -3201,7 +3201,7 @@ GenTree* Compiler::optAssertionPropGlobal_RelOp(ASSERT_VALARG_TP assertions, Gen
         {
             double constant = vnStore->ConstantValue<double>(vnCns);
             op1->ChangeOperConst(GT_CNS_DBL);
-            op1->gtDblCon.gtDconVal = constant;
+            op1->AsDblCon()->gtDconVal = constant;
 
             // Nothing can be equal to NaN. So if IL had "op1 == NaN", then we already made op1 NaN,
             // which will yield a false correctly. Instead if IL had "op1 != NaN", then we already
@@ -3213,7 +3213,7 @@ GenTree* Compiler::optAssertionPropGlobal_RelOp(ASSERT_VALARG_TP assertions, Gen
         {
             float constant = vnStore->ConstantValue<float>(vnCns);
             op1->ChangeOperConst(GT_CNS_DBL);
-            op1->gtDblCon.gtDconVal = constant;
+            op1->AsDblCon()->gtDconVal = constant;
             // See comments for TYP_DOUBLE.
             allowReverse = (_isnan(constant) == 0);
         }
@@ -3254,9 +3254,9 @@ GenTree* Compiler::optAssertionPropGlobal_RelOp(ASSERT_VALARG_TP assertions, Gen
             // now. We don't create OAK_EQUAL assertion on floating point from GT_ASG
             // because we depend on value num which would constant prop the NaN.
             op1->ChangeOperConst(GT_CNS_DBL);
-            op1->gtDblCon.gtDconVal = 0;
+            op1->AsDblCon()->gtDconVal = 0;
             op2->ChangeOperConst(GT_CNS_DBL);
-            op2->gtDblCon.gtDconVal = 0;
+            op2->AsDblCon()->gtDconVal = 0;
         }
         // Change the op1 LclVar to the op2 LclVar
         else
index fe95bb0b4eda5009c3ced51d1db45234fca8f966..70b1b9159abba23bed4733ab3176019baf5ade23 100644 (file)
@@ -248,7 +248,7 @@ void CodeGen::genSetRegToConst(regNumber targetReg, var_types targetType, GenTre
         case GT_CNS_DBL:
         {
             GenTreeDblCon* dblConst   = tree->AsDblCon();
-            double         constValue = dblConst->gtDblCon.gtDconVal;
+            double         constValue = dblConst->AsDblCon()->gtDconVal;
             // TODO-ARM-CQ: Do we have a faster/smaller way to generate 0.0 in thumb2 ISA ?
             if (targetType == TYP_FLOAT)
             {
index 4a20daee680feda0229e21bfe6f6217e3312b84c..2105a13c7fec23518494dac094b2cafd0f4c04d0 100644 (file)
@@ -530,7 +530,7 @@ void CodeGen::genSetRegToConst(regNumber targetReg, var_types targetType, GenTre
         {
             emitter* emit       = GetEmitter();
             emitAttr size       = emitTypeSize(targetType);
-            double   constValue = tree->gtDblCon.gtDconVal;
+            double   constValue = tree->AsDblCon()->gtDconVal;
 
             // Make sure we use "xorps reg, reg" only for +ve zero constant (0.0) and not for -ve zero (-0.0)
             if (*(__int64*)&constValue == 0)
index b35a510acced155d69b84cd2443b069c68c25a38..b9b0094230b50acadc364b47ac48f07ef0e46a11 100644 (file)
@@ -1297,7 +1297,7 @@ AGAIN:
             break;
 
         case GT_CNS_DBL:
-            if  (op1->gtDblCon.gtDconVal == op2->gtDblCon.gtDconVal)
+            if  (op1->AsDblCon()->gtDconVal == op2->AsDblCon()->gtDconVal)
                 return true;
             break;
 #endif
@@ -1986,7 +1986,7 @@ AGAIN:
 #endif
                 break;
             case GT_CNS_DBL:
-                bits = *(UINT64*)(&tree->gtDblCon.gtDconVal);
+                bits = *(UINT64*)(&tree->AsDblCon()->gtDconVal);
 #ifdef _HOST_64BIT_
                 add = bits;
 #else // 32-bit host
@@ -3364,8 +3364,8 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
                 level = 0;
                 /* We use fldz and fld1 to load 0.0 and 1.0, but all other  */
                 /* floating point constants are loaded using an indirection */
-                if ((*((__int64*)&(tree->gtDblCon.gtDconVal)) == 0) ||
-                    (*((__int64*)&(tree->gtDblCon.gtDconVal)) == I64(0x3ff0000000000000)))
+                if ((*((__int64*)&(tree->AsDblCon()->gtDconVal)) == 0) ||
+                    (*((__int64*)&(tree->AsDblCon()->gtDconVal)) == I64(0x3ff0000000000000)))
                 {
                     costEx = 1;
                     costSz = 1;
@@ -7110,7 +7110,7 @@ GenTree* Compiler::gtCloneExpr(
                 goto DONE;
 
             case GT_CNS_DBL:
-                copy         = gtNewDconNode(tree->gtDblCon.gtDconVal);
+                copy         = gtNewDconNode(tree->AsDblCon()->gtDconVal);
                 copy->gtType = tree->gtType; // keep the same type
                 goto DONE;
 
@@ -10471,13 +10471,13 @@ void Compiler::gtDispConst(GenTree* tree)
             break;
 
         case GT_CNS_DBL:
-            if (*((__int64*)&tree->gtDblCon.gtDconVal) == (__int64)I64(0x8000000000000000))
+            if (*((__int64*)&tree->AsDblCon()->gtDconVal) == (__int64)I64(0x8000000000000000))
             {
                 printf(" -0.00000");
             }
             else
             {
-                printf(" %#.17g", tree->gtDblCon.gtDconVal);
+                printf(" %#.17g", tree->AsDblCon()->gtDconVal);
             }
             break;
         case GT_CNS_STR:
@@ -13647,7 +13647,7 @@ GenTree* Compiler::gtFoldExprConst(GenTree* tree)
 
                 /* Fold constant DOUBLE unary operator */
 
-                d1 = op1->gtDblCon.gtDconVal;
+                d1 = op1->AsDblCon()->gtDconVal;
 
                 switch (tree->gtOper)
                 {
@@ -14551,11 +14551,11 @@ GenTree* Compiler::gtFoldExprConst(GenTree* tree)
             }
 
             assert(op1->gtOper == GT_CNS_DBL);
-            d1 = op1->gtDblCon.gtDconVal;
+            d1 = op1->AsDblCon()->gtDconVal;
 
             assert(varTypeIsFloating(op2->gtType));
             assert(op2->gtOper == GT_CNS_DBL);
-            d2 = op2->gtDblCon.gtDconVal;
+            d2 = op2->AsDblCon()->gtDconVal;
 
             /* Special case - check if we have NaN operands.
              * For comparisons if not an unordered operation always return 0.
@@ -14695,7 +14695,7 @@ GenTree* Compiler::gtFoldExprConst(GenTree* tree)
                    (tree->gtDebugFlags & GTF_DEBUG_NODE_LARGE));
 
             tree->ChangeOperConst(GT_CNS_DBL);
-            tree->gtDblCon.gtDconVal = d1;
+            tree->AsDblCon()->gtDconVal = d1;
             if (vnStore != nullptr)
             {
                 fgValueNumberTreeConst(tree);
index 38b1a1e757c72d16bb332efb820ebc436df91acc..9a035518344313e780c56e87cb2a1a181aa92175 100644 (file)
@@ -6429,7 +6429,7 @@ inline bool GenTree::OperIsCopyBlkOp()
 
 inline bool GenTree::IsFPZero()
 {
-    if ((gtOper == GT_CNS_DBL) && (gtDblCon.gtDconVal == 0.0))
+    if ((gtOper == GT_CNS_DBL) && (AsDblCon()->gtDconVal == 0.0))
     {
         return true;
     }
@@ -6975,7 +6975,7 @@ inline bool GenTree::IsCnsNonZeroFltOrDbl()
 {
     if (OperGet() == GT_CNS_DBL)
     {
-        double constValue = gtDblCon.gtDconVal;
+        double constValue = AsDblCon()->gtDconVal;
         return *(__int64*)&constValue != 0;
     }
 
index 34d371a4f7e2af2c95a530de6cd38cb9e0103abf..806f9b71c93d707d1ca4e02c3118b4a201a85afe 100644 (file)
@@ -147,7 +147,7 @@ int LinearScan::BuildNode(GenTree* tree)
         case GT_CNS_DBL:
         {
             GenTreeDblCon* dblConst   = tree->AsDblCon();
-            double         constValue = dblConst->gtDblCon.gtDconVal;
+            double         constValue = dblConst->AsDblCon()->gtDconVal;
 
             if (emitter::emitIns_valid_imm_for_fmov(constValue))
             {
index d57662d3ad2a6c225fabfa7b08cffec505116138..31d53128691b29fdc2e1c09cc13a9b5c1f37913a 100644 (file)
@@ -718,7 +718,7 @@ OPTIMIZECAST:
                         else if (varTypeIsFloating(tree->gtType))
                         {
                             commaOp2->ChangeOperConst(GT_CNS_DBL);
-                            commaOp2->gtDblCon.gtDconVal = 0.0;
+                            commaOp2->AsDblCon()->gtDconVal = 0.0;
                             // Change the types of oper and commaOp2
                             oper->gtType = commaOp2->gtType = tree->gtType;
                         }
@@ -13483,7 +13483,7 @@ DONE_MORPHING_CHILDREN:
                         else if (varTypeIsFloating(typ))
                         {
                             commaOp2->ChangeOperConst(GT_CNS_DBL);
-                            commaOp2->gtDblCon.gtDconVal = 0.0;
+                            commaOp2->AsDblCon()->gtDconVal = 0.0;
                             /* Change the types of oper and commaOp2 to TYP_DOUBLE */
                             op1->gtType = commaOp2->gtType = TYP_DOUBLE;
                         }
index c36670d4a97c9cf2b87f4ab71f79702e4675bbb9..94580b8b747cc06a24ed4e8819b8656e0a619a44 100644 (file)
@@ -6331,10 +6331,10 @@ void Compiler::fgValueNumberTreeConst(GenTree* tree)
             break;
 
         case TYP_FLOAT:
-            tree->gtVNPair.SetBoth(vnStore->VNForFloatCon((float)tree->gtDblCon.gtDconVal));
+            tree->gtVNPair.SetBoth(vnStore->VNForFloatCon((float)tree->AsDblCon()->gtDconVal));
             break;
         case TYP_DOUBLE:
-            tree->gtVNPair.SetBoth(vnStore->VNForDoubleCon(tree->gtDblCon.gtDconVal));
+            tree->gtVNPair.SetBoth(vnStore->VNForDoubleCon(tree->AsDblCon()->gtDconVal));
             break;
         case TYP_REF:
             if (tree->gtIntConCommon.IconValue() == 0)