Skip to content

Commit 3fce4e7

Browse files
authored
Remove O1K_VALUE_NUMBER (#101894)
1 parent 35ad5e1 commit 3fce4e7

File tree

2 files changed

+15
-78
lines changed

2 files changed

+15
-78
lines changed

src/coreclr/jit/assertionprop.cpp

+15-77
Original file line numberDiff line numberDiff line change
@@ -795,11 +795,6 @@ void Compiler::optPrintAssertion(AssertionDsc* curAssertion, AssertionIndex asse
795795
printf("Const_Loop_Bnd_Un");
796796
vnStore->vnDump(this, curAssertion->op1.vn);
797797
}
798-
else if (curAssertion->op1.kind == O1K_VALUE_NUMBER)
799-
{
800-
printf("Value_Number");
801-
vnStore->vnDump(this, curAssertion->op1.vn);
802-
}
803798
else
804799
{
805800
printf("?op1.kind?");
@@ -897,18 +892,7 @@ void Compiler::optPrintAssertion(AssertionDsc* curAssertion, AssertionIndex asse
897892
}
898893
else
899894
{
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;
912896
if (op1Type == TYP_REF)
913897
{
914898
if (curAssertion->op2.u1.iconVal == 0)
@@ -1175,64 +1159,23 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1,
11751159

11761160
ValueNum vn;
11771161

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()))
11841164
{
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
12211166
}
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-
}
12291167

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
12341172
}
12351173

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+
12361179
assertion.op1.vn = vn;
12371180
assertion.assertionKind = assertionKind;
12381181
assertion.op2.kind = O2K_CONST_INT;
@@ -1597,7 +1540,7 @@ AssertionIndex Compiler::optFinalizeCreatingAssertion(AssertionDsc* assertion)
15971540
}
15981541

15991542
// 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)
16011544
{
16021545
return NO_ASSERTION_INDEX;
16031546
}
@@ -1866,7 +1809,6 @@ void Compiler::optDebugCheckAssertion(AssertionDsc* assertion)
18661809
case O1K_BOUND_LOOP_BND:
18671810
case O1K_CONSTANT_LOOP_BND:
18681811
case O1K_CONSTANT_LOOP_BND_UN:
1869-
case O1K_VALUE_NUMBER:
18701812
assert(!optLocalAssertionProp);
18711813
break;
18721814
default:
@@ -1887,9 +1829,6 @@ void Compiler::optDebugCheckAssertion(AssertionDsc* assertion)
18871829
assert((lvaGetDesc(assertion->op1.lcl.lclNum)->lvType != TYP_REF) ||
18881830
(assertion->op2.u1.iconVal == 0) || doesMethodHaveFrozenObjects());
18891831
break;
1890-
case O1K_VALUE_NUMBER:
1891-
assert((vnStore->TypeOfVN(assertion->op1.vn) != TYP_REF) || (assertion->op2.u1.iconVal == 0));
1892-
break;
18931832
default:
18941833
break;
18951834
}
@@ -5680,8 +5619,7 @@ void Compiler::optImpliedByTypeOfAssertions(ASSERT_TP& activeAssertions)
56805619
}
56815620

56825621
// 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) ||
56855623
(impAssertion->op2.kind != O2K_CONST_INT) || (impAssertion->op1.vn != chkAssertion->op1.vn))
56865624
{
56875625
continue;

src/coreclr/jit/compiler.h

-1
Original file line numberDiff line numberDiff line change
@@ -7533,7 +7533,6 @@ class Compiler
75337533
O1K_CONSTANT_LOOP_BND_UN,
75347534
O1K_EXACT_TYPE,
75357535
O1K_SUBTYPE,
7536-
O1K_VALUE_NUMBER,
75377536
O1K_COUNT
75387537
};
75397538

0 commit comments

Comments
 (0)