Skip to content

Commit

Permalink
Fix broken float compare mapping to VNFunc (dotnet#20782)
Browse files Browse the repository at this point in the history
* Fix broken float compare mapping to VNFunc

The existing code uses GTF_UNSIGNED instead of GTF_RELOP_NAN_UN to select unordered VN funcs.

* Rename relopFuncs
  • Loading branch information
mikedn authored and Sergey Andreenko committed Sep 5, 2019
1 parent ee423d1 commit f23c07f
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 261 deletions.
14 changes: 6 additions & 8 deletions src/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17267,16 +17267,15 @@ void GenTree::ParseArrayAddress(
// Perform ((inxVN / elemSizeVN) + vnForConstInd)
if (!canFoldDiv)
{
ValueNum vnForElemSize = vnStore->VNForPtrSizeIntCon(elemSize);
ValueNum vnForScaledInx =
vnStore->VNForFunc(TYP_I_IMPL, GetVNFuncForOper(GT_DIV, VOK_Default), inxVN, vnForElemSize);
*pInxVN = vnForScaledInx;
ValueNum vnForElemSize = vnStore->VNForPtrSizeIntCon(elemSize);
ValueNum vnForScaledInx = vnStore->VNForFunc(TYP_I_IMPL, VNFunc(GT_DIV), inxVN, vnForElemSize);
*pInxVN = vnForScaledInx;
}

if (constInd != 0)
{
ValueNum vnForConstInd = comp->GetValueNumStore()->VNForPtrSizeIntCon(constInd);
VNFunc vnFunc = GetVNFuncForOper(GT_ADD, VOK_Default);
VNFunc vnFunc = VNFunc(GT_ADD);

*pInxVN = comp->GetValueNumStore()->VNForFunc(TYP_I_IMPL, vnFunc, *pInxVN, vnForConstInd);
}
Expand Down Expand Up @@ -17394,16 +17393,15 @@ void GenTree::ParseArrayAddressWork(Compiler* comp,
if (inputMul != 1)
{
ValueNum mulVN = comp->GetValueNumStore()->VNForLongCon(inputMul);
vn = comp->GetValueNumStore()->VNForFunc(TypeGet(), GetVNFuncForOper(GT_MUL, VOK_Default), mulVN, vn);
vn = comp->GetValueNumStore()->VNForFunc(TypeGet(), VNFunc(GT_MUL), mulVN, vn);
}
if (*pInxVN == ValueNumStore::NoVN)
{
*pInxVN = vn;
}
else
{
*pInxVN =
comp->GetValueNumStore()->VNForFunc(TypeGet(), GetVNFuncForOper(GT_ADD, VOK_Default), *pInxVN, vn);
*pInxVN = comp->GetValueNumStore()->VNForFunc(TypeGet(), VNFunc(GT_ADD), *pInxVN, vn);
}
}
}
Expand Down
Loading

0 comments on commit f23c07f

Please sign in to comment.