unsigned index = 0;
while (iter.NextElem(&index))
{
- index++;
- if (index > optAssertionCount)
+ AssertionIndex assertionIndex = GetAssertionIndex(index);
+ if (assertionIndex > optAssertionCount)
{
break;
}
// See if the variable is equal to a constant or another variable.
- AssertionDsc* curAssertion = optGetAssertion((AssertionIndex)index);
+ AssertionDsc* curAssertion = optGetAssertion(assertionIndex);
if (curAssertion->assertionKind != OAK_EQUAL || curAssertion->op1.kind != O1K_LCLVAR)
{
continue;
if (optLocalAssertionProp)
{
// Perform copy assertion prop.
- GenTreePtr newTree = optCopyAssertionProp(curAssertion, tree, stmt DEBUGARG((AssertionIndex)index));
+ GenTreePtr newTree = optCopyAssertionProp(curAssertion, tree, stmt DEBUGARG(assertionIndex));
if (newTree == nullptr)
{
// Skip and try next assertion.
// If local assertion prop just, perform constant prop.
if (optLocalAssertionProp)
{
- return optConstantAssertionProp(curAssertion, tree, stmt DEBUGARG((AssertionIndex)index));
+ return optConstantAssertionProp(curAssertion, tree, stmt DEBUGARG(assertionIndex));
}
// If global assertion, perform constant propagation only if the VN's match and the lcl is non-CSE.
else if (curAssertion->op1.vn == tree->gtVNPair.GetConservative())
if (!lclNumIsCSE(tree->AsLclVarCommon()->GetLclNum()))
#endif
{
- return optConstantAssertionProp(curAssertion, tree, stmt DEBUGARG((AssertionIndex)index));
+ return optConstantAssertionProp(curAssertion, tree, stmt DEBUGARG(assertionIndex));
}
}
}
unsigned index = 0;
while (iter.NextElem(&index))
{
- index++;
- if (index > optAssertionCount)
+ AssertionIndex assertionIndex = GetAssertionIndex(index);
+ if (assertionIndex > optAssertionCount)
{
break;
}
- AssertionDsc* curAssertion = optGetAssertion((AssertionIndex)index);
+ AssertionDsc* curAssertion = optGetAssertion(assertionIndex);
if ((curAssertion->assertionKind != OAK_EQUAL && curAssertion->assertionKind != OAK_NOT_EQUAL))
{
continue;
if (curAssertion->op1.vn == op1->gtVNPair.GetConservative() &&
curAssertion->op2.vn == op2->gtVNPair.GetConservative())
{
- return (AssertionIndex)index;
+ return assertionIndex;
}
}
return NO_ASSERTION_INDEX;
return nullptr;
}
- unsigned index = optAssertionIsSubrange(lcl, toType, assertions);
+ AssertionIndex index = optAssertionIsSubrange(lcl, toType, assertions);
if (index != NO_ASSERTION_INDEX)
{
LclVarDsc* varDsc = &lvaTable[lcl->gtLclVarCommon.gtLclNum];
unsigned index = 0;
while (iter.NextElem(&index))
{
- index++;
- if (index > optAssertionCount)
+ AssertionIndex assertionIndex = GetAssertionIndex(index);
+ if (assertionIndex > optAssertionCount)
{
break;
}
- AssertionDsc* curAssertion = optGetAssertion((AssertionIndex)index);
+ AssertionDsc* curAssertion = optGetAssertion(assertionIndex);
if (curAssertion->assertionKind != OAK_NOT_EQUAL)
{
continue;
{
continue;
}
- return (AssertionIndex)index;
+ return assertionIndex;
}
}
else
unsigned index = 0;
while (iter.NextElem(&index))
{
- index++;
- if (index > optAssertionCount)
+ AssertionIndex assertionIndex = GetAssertionIndex(index);
+ if (assertionIndex > optAssertionCount)
{
break;
}
// If it is not a nothrow assertion, skip.
- AssertionDsc* curAssertion = optGetAssertion((AssertionIndex)index);
+ AssertionDsc* curAssertion = optGetAssertion(assertionIndex);
if (!curAssertion->IsBoundsCheckNoThrow())
{
continue;
#ifdef DEBUG
if (verbose)
{
- printf("\nVN based redundant (%s) bounds check assertion prop for index #%02u in BB%02u:\n", dbgMsg, index,
- compCurBB->bbNum);
+ printf("\nVN based redundant (%s) bounds check assertion prop for index #%02u in BB%02u:\n", dbgMsg,
+ assertionIndex, compCurBB->bbNum);
gtDispTree(tree, nullptr, nullptr, true);
}
#endif
unsigned chkIndex = 0;
while (chkIter.NextElem(&chkIndex))
{
- chkIndex++;
- if (chkIndex > optAssertionCount)
+ AssertionIndex chkAssertionIndex = GetAssertionIndex(chkIndex);
+ if (chkAssertionIndex > optAssertionCount)
{
break;
}
- if (chkIndex == assertionIndex)
+ if (chkAssertionIndex == assertionIndex)
{
continue;
}
// Determine which one is a copy assertion and use the other to check for implied assertions.
- AssertionDsc* iterAssertion = optGetAssertion((AssertionIndex)chkIndex);
+ AssertionDsc* iterAssertion = optGetAssertion(chkAssertionIndex);
if (curAssertion->IsCopyAssertion())
{
optImpliedByCopyAssertion(curAssertion, iterAssertion, activeAssertions);
unsigned chkIndex = 0;
while (chkIter.NextElem(&chkIndex))
{
- chkIndex++;
- if (chkIndex > optAssertionCount)
+ AssertionIndex chkAssertionIndex = GetAssertionIndex(chkIndex);
+ if (chkAssertionIndex > optAssertionCount)
{
break;
}
// chkAssertion must be Type/Subtype is equal assertion
- AssertionDsc* chkAssertion = optGetAssertion((AssertionIndex)chkIndex);
+ AssertionDsc* chkAssertion = optGetAssertion(chkAssertionIndex);
if ((chkAssertion->op1.kind != O1K_SUBTYPE && chkAssertion->op1.kind != O1K_EXACT_TYPE) ||
(chkAssertion->assertionKind != OAK_EQUAL))
{
}
// Search the assertion table for a non-null assertion on op1 that matches chkAssertion
- for (unsigned impIndex = 1; impIndex <= optAssertionCount; impIndex++)
+ for (AssertionIndex impIndex = 1; impIndex <= optAssertionCount; impIndex++)
{
- AssertionDsc* impAssertion = optGetAssertion((AssertionIndex)impIndex);
+ AssertionDsc* impAssertion = optGetAssertion(impIndex);
// The impAssertion must be different from the chkAssertion
- if (impIndex == chkIndex)
+ if (impIndex == chkAssertionIndex)
{
continue;
}
if (verbose)
{
printf("\nCompiler::optImpliedByTypeOfAssertions: %s Assertion #%02d, implies assertion #%02d",
- (chkAssertion->op1.kind == O1K_SUBTYPE) ? "Subtype" : "Exact-type", chkIndex, impIndex);
+ (chkAssertion->op1.kind == O1K_SUBTYPE) ? "Subtype" : "Exact-type", chkAssertionIndex,
+ impIndex);
}
#endif
}
unsigned chkIndex = 0;
while (chkIter.NextElem(&chkIndex))
{
- chkIndex++;
- if (chkIndex > optAssertionCount)
+ AssertionIndex chkAssertionIndex = GetAssertionIndex(chkIndex);
+ if (chkAssertionIndex > optAssertionCount)
{
break;
}
// The impAssertion must be different from the const assertion.
- AssertionDsc* impAssertion = optGetAssertion((AssertionIndex)chkIndex);
+ AssertionDsc* impAssertion = optGetAssertion(chkAssertionIndex);
if (impAssertion == constAssertion)
{
continue;
if (usable)
{
- BitVecOps::AddElemD(apTraits, result, chkIndex - 1);
+ BitVecOps::AddElemD(apTraits, result, chkIndex);
#ifdef DEBUG
if (verbose)
{