Fix slot size for transformed long
authorHyeongseok Oh <hseok82.oh@samsung.com>
Wed, 1 Nov 2017 01:41:59 +0000 (10:41 +0900)
committerHyeongseok Oh <hseok82.oh@samsung.com>
Wed, 1 Nov 2017 01:41:59 +0000 (10:41 +0900)
Fix slot size as 2 for transformed long from double
Use expected slot size for assertion check

src/jit/lsraarmarch.cpp

index 08001fb..b13362d 100644 (file)
@@ -463,22 +463,22 @@ void LinearScan::TreeNodeInfoInitCall(GenTreeCall* call)
             GenTree* putArgChild = argNode->gtGetOp1();
             if (!varTypeIsStruct(putArgChild) && !putArgChild->OperIs(GT_FIELD_LIST))
             {
+                unsigned expectedSlots = 1;
 #ifdef _TARGET_ARM_
                 // The `double` types could been transformed to `long` on arm, while the actual longs
                 // have been decomposed.
-                const bool isDouble = (putArgChild->TypeGet() == TYP_LONG || putArgChild->TypeGet() == TYP_DOUBLE);
-                if (isDouble)
+                if (putArgChild->TypeGet() == TYP_LONG)
                 {
                     argNode->gtLsraInfo.srcCount = 2;
+                    expectedSlots                = 2;
+                }
+                else if (putArgChild->TypeGet() == TYP_DOUBLE)
+                {
+                    expectedSlots = 2;
                 }
-
-                // We must not have a multi-reg struct; double uses 2 slots and isn't a multi-reg struct
-                assert((curArgTabEntry->numSlots == 1) || isDouble);
-#else  // !_TARGET_ARM_
-                // Validate the slot count for this arg.
-                // We must not have a multi-reg struct
-                assert(curArgTabEntry->numSlots == 1);
 #endif // !_TARGET_ARM_
+                // Validate the slot count for this arg.
+                assert(curArgTabEntry->numSlots == expectedSlots);
             }
             continue;
         }