@@ -795,11 +795,6 @@ void Compiler::optPrintAssertion(AssertionDsc* curAssertion, AssertionIndex asse
795
795
printf (" Const_Loop_Bnd_Un" );
796
796
vnStore->vnDump (this , curAssertion->op1 .vn );
797
797
}
798
- else if (curAssertion->op1 .kind == O1K_VALUE_NUMBER)
799
- {
800
- printf (" Value_Number" );
801
- vnStore->vnDump (this , curAssertion->op1 .vn );
802
- }
803
798
else
804
799
{
805
800
printf (" ?op1.kind?" );
@@ -897,18 +892,7 @@ void Compiler::optPrintAssertion(AssertionDsc* curAssertion, AssertionIndex asse
897
892
}
898
893
else
899
894
{
900
- var_types op1Type;
901
-
902
- if (curAssertion->op1 .kind == O1K_VALUE_NUMBER)
903
- {
904
- op1Type = vnStore->TypeOfVN (curAssertion->op1 .vn );
905
- }
906
- else
907
- {
908
- unsigned lclNum = curAssertion->op1 .lcl .lclNum ;
909
- op1Type = lvaGetDesc (lclNum)->lvType ;
910
- }
911
-
895
+ var_types op1Type = lvaGetDesc (curAssertion->op1 .lcl .lclNum )->lvType ;
912
896
if (op1Type == TYP_REF)
913
897
{
914
898
if (curAssertion->op2 .u1 .iconVal == 0 )
@@ -1175,64 +1159,23 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1,
1175
1159
1176
1160
ValueNum vn;
1177
1161
1178
- //
1179
- // We only perform null-checks on GC refs
1180
- // so only make non-null assertions about GC refs or byrefs if we can't determine
1181
- // the corresponding ref.
1182
- //
1183
- if (lclVar->TypeGet () != TYP_REF)
1162
+ // We only perform null-checks on byrefs and GC refs
1163
+ if (!varTypeIsGC (lclVar->TypeGet ()))
1184
1164
{
1185
- if (optLocalAssertionProp || (lclVar->TypeGet () != TYP_BYREF))
1186
- {
1187
- goto DONE_ASSERTION; // Don't make an assertion
1188
- }
1189
-
1190
- vn = optConservativeNormalVN (op1);
1191
- VNFuncApp funcAttr;
1192
-
1193
- // Try to get value number corresponding to the GC ref of the indirection
1194
- while (vnStore->GetVNFunc (vn, &funcAttr) && (funcAttr.m_func == (VNFunc)GT_ADD) &&
1195
- (vnStore->TypeOfVN (vn) == TYP_BYREF))
1196
- {
1197
- if (vnStore->IsVNConstant (funcAttr.m_args [1 ]) &&
1198
- varTypeIsIntegral (vnStore->TypeOfVN (funcAttr.m_args [1 ])))
1199
- {
1200
- offset += vnStore->CoercedConstantValue <ssize_t >(funcAttr.m_args [1 ]);
1201
- vn = funcAttr.m_args [0 ];
1202
- }
1203
- else if (vnStore->IsVNConstant (funcAttr.m_args [0 ]) &&
1204
- varTypeIsIntegral (vnStore->TypeOfVN (funcAttr.m_args [0 ])))
1205
- {
1206
- offset += vnStore->CoercedConstantValue <ssize_t >(funcAttr.m_args [0 ]);
1207
- vn = funcAttr.m_args [1 ];
1208
- }
1209
- else
1210
- {
1211
- break ;
1212
- }
1213
- }
1214
-
1215
- if (fgIsBigOffset (offset))
1216
- {
1217
- goto DONE_ASSERTION; // Don't make an assertion
1218
- }
1219
-
1220
- assertion.op1 .kind = O1K_VALUE_NUMBER;
1165
+ goto DONE_ASSERTION; // Don't make an assertion
1221
1166
}
1222
- else
1223
- {
1224
- // If the local variable has its address exposed then bail
1225
- if (lclVar->IsAddressExposed ())
1226
- {
1227
- goto DONE_ASSERTION; // Don't make an assertion
1228
- }
1229
1167
1230
- assertion. op1 . kind = O1K_LCLVAR;
1231
- assertion. op1 . lcl . lclNum = lclNum;
1232
- assertion. op1 . lcl . ssaNum = op1-> AsLclVarCommon ()-> GetSsaNum ();
1233
- vn = optConservativeNormalVN (op1);
1168
+ // If the local variable has its address exposed then bail
1169
+ if (lclVar-> IsAddressExposed ())
1170
+ {
1171
+ goto DONE_ASSERTION; // Don't make an assertion
1234
1172
}
1235
1173
1174
+ assertion.op1 .kind = O1K_LCLVAR;
1175
+ assertion.op1 .lcl .lclNum = lclNum;
1176
+ assertion.op1 .lcl .ssaNum = op1->AsLclVarCommon ()->GetSsaNum ();
1177
+ vn = optConservativeNormalVN (op1);
1178
+
1236
1179
assertion.op1 .vn = vn;
1237
1180
assertion.assertionKind = assertionKind;
1238
1181
assertion.op2 .kind = O2K_CONST_INT;
@@ -1597,7 +1540,7 @@ AssertionIndex Compiler::optFinalizeCreatingAssertion(AssertionDsc* assertion)
1597
1540
}
1598
1541
1599
1542
// TODO: only copy assertions rely on valid SSA number so we could generate more assertions here
1600
- if (( assertion->op1 .kind != O1K_VALUE_NUMBER) && (assertion-> op1 . lcl .ssaNum == SsaConfig::RESERVED_SSA_NUM) )
1543
+ if (assertion->op1 .lcl .ssaNum == SsaConfig::RESERVED_SSA_NUM)
1601
1544
{
1602
1545
return NO_ASSERTION_INDEX;
1603
1546
}
@@ -1866,7 +1809,6 @@ void Compiler::optDebugCheckAssertion(AssertionDsc* assertion)
1866
1809
case O1K_BOUND_LOOP_BND:
1867
1810
case O1K_CONSTANT_LOOP_BND:
1868
1811
case O1K_CONSTANT_LOOP_BND_UN:
1869
- case O1K_VALUE_NUMBER:
1870
1812
assert (!optLocalAssertionProp);
1871
1813
break ;
1872
1814
default :
@@ -1887,9 +1829,6 @@ void Compiler::optDebugCheckAssertion(AssertionDsc* assertion)
1887
1829
assert ((lvaGetDesc (assertion->op1 .lcl .lclNum )->lvType != TYP_REF) ||
1888
1830
(assertion->op2 .u1 .iconVal == 0 ) || doesMethodHaveFrozenObjects ());
1889
1831
break ;
1890
- case O1K_VALUE_NUMBER:
1891
- assert ((vnStore->TypeOfVN (assertion->op1 .vn ) != TYP_REF) || (assertion->op2 .u1 .iconVal == 0 ));
1892
- break ;
1893
1832
default :
1894
1833
break ;
1895
1834
}
@@ -5680,8 +5619,7 @@ void Compiler::optImpliedByTypeOfAssertions(ASSERT_TP& activeAssertions)
5680
5619
}
5681
5620
5682
5621
// impAssertion must be a Non Null assertion on lclNum
5683
- if ((impAssertion->assertionKind != OAK_NOT_EQUAL) ||
5684
- ((impAssertion->op1 .kind != O1K_LCLVAR) && (impAssertion->op1 .kind != O1K_VALUE_NUMBER)) ||
5622
+ if ((impAssertion->assertionKind != OAK_NOT_EQUAL) || (impAssertion->op1 .kind != O1K_LCLVAR) ||
5685
5623
(impAssertion->op2 .kind != O2K_CONST_INT) || (impAssertion->op1 .vn != chkAssertion->op1 .vn ))
5686
5624
{
5687
5625
continue ;
0 commit comments