@@ -7820,8 +7820,9 @@ GenTree* Compiler::gtCloneExpr(
7820
7820
break;
7821
7821
7822
7822
case GT_CAST:
7823
- copy = new (this, LargeOpOpcode()) GenTreeCast(tree->TypeGet(), tree->gtCast.CastOp(),
7824
- tree->gtCast.gtCastType DEBUGARG(/*largeNode*/ TRUE));
7823
+ copy =
7824
+ new (this, LargeOpOpcode()) GenTreeCast(tree->TypeGet(), tree->gtCast.CastOp(), tree->IsUnsigned(),
7825
+ tree->gtCast.gtCastType DEBUGARG(/*largeNode*/ TRUE));
7825
7826
break;
7826
7827
7827
7828
// The nodes below this are not bashed, so they can be allocated at their individual sizes.
@@ -7993,10 +7994,6 @@ GenTree* Compiler::gtCloneExpr(
7993
7994
{
7994
7995
copy->gtFlags |= GTF_OVERFLOW;
7995
7996
}
7996
- if (copy->OperGet() == GT_CAST)
7997
- {
7998
- copy->gtFlags |= (tree->gtFlags & GTF_UNSIGNED);
7999
- }
8000
7997
8001
7998
if (tree->gtOp.gtOp1)
8002
7999
{
@@ -14000,15 +13997,22 @@ GenTree* Compiler::gtFoldExprConst(GenTree* tree)
14000
13997
goto CNS_INT;
14001
13998
14002
13999
case TYP_ULONG:
14003
- if (!( tree->gtFlags & GTF_UNSIGNED) && tree->gtOverflow() && i1 < 0 )
14000
+ if (tree->IsUnsigned() )
14004
14001
{
14005
- goto LNG_OVF;
14002
+ lval1 = UINT64(UINT32(i1));
14003
+ }
14004
+ else
14005
+ {
14006
+ if (tree->gtOverflow() && (i1 < 0))
14007
+ {
14008
+ goto LNG_OVF;
14009
+ }
14010
+ lval1 = UINT64(INT32(i1));
14006
14011
}
14007
- lval1 = UINT64(UINT32(i1));
14008
14012
goto CNS_LONG;
14009
14013
14010
14014
case TYP_LONG:
14011
- if (tree->gtFlags & GTF_UNSIGNED )
14015
+ if (tree->IsUnsigned() )
14012
14016
{
14013
14017
lval1 = INT64(UINT32(i1));
14014
14018
}
@@ -15431,11 +15435,11 @@ GenTree* Compiler::gtNewRefCOMfield(GenTree* objPtr,
15431
15435
}
15432
15436
else if (lclTyp == TYP_DOUBLE && assg->TypeGet() == TYP_FLOAT)
15433
15437
{
15434
- assg = gtNewCastNode(TYP_DOUBLE, assg, TYP_DOUBLE);
15438
+ assg = gtNewCastNode(TYP_DOUBLE, assg, false, TYP_DOUBLE);
15435
15439
}
15436
15440
else if (lclTyp == TYP_FLOAT && assg->TypeGet() == TYP_DOUBLE)
15437
15441
{
15438
- assg = gtNewCastNode(TYP_FLOAT, assg, TYP_FLOAT);
15442
+ assg = gtNewCastNode(TYP_FLOAT, assg, false, TYP_FLOAT);
15439
15443
}
15440
15444
15441
15445
args = gtNewArgList(assg);
@@ -15495,7 +15499,7 @@ GenTree* Compiler::gtNewRefCOMfield(GenTree* objPtr,
15495
15499
else if (varTypeIsIntegral(lclTyp) && genTypeSize(lclTyp) < genTypeSize(TYP_INT))
15496
15500
{
15497
15501
// The helper does not extend the small return types.
15498
- tree = gtNewCastNode(genActualType(lclTyp), tree, lclTyp);
15502
+ tree = gtNewCastNode(genActualType(lclTyp), tree, false, lclTyp);
15499
15503
}
15500
15504
}
15501
15505
}
0 commit comments