Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion src/jit/optcse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1971,6 +1971,32 @@ class CSE_Heuristic
return result;
}

// IsCompatibleType() takes two var_types and returns true if they
// are compatible types for CSE substitution
//
bool IsCompatibleType(var_types cseLclVarTyp, var_types expTyp)
{
// Exact type match is the expected case
if (cseLclVarTyp == expTyp)
{
return true;
}

// We also allow TYP_BYREF and TYP_I_IMPL as compatible types
//
if ((cseLclVarTyp == TYP_BYREF) && (expTyp == TYP_I_IMPL))
{
return true;
}
if ((cseLclVarTyp == TYP_I_IMPL) && (expTyp == TYP_BYREF))
{
return true;
}

// Otherwise we have incompatible types
return false;
}

// PerformCSE() takes a successful candidate and performs the appropriate replacements:
//
// It will replace all of the CSE defs with assignments to a new "cse0" LclVar
Expand Down Expand Up @@ -2105,7 +2131,10 @@ class CSE_Heuristic

/* Figure out the actual type of the value */
var_types expTyp = genActualType(exp->TypeGet());
noway_assert(expTyp == cseLclVarTyp);

// The cseLclVarType must be a compatible with expTyp
//
noway_assert(IsCompatibleType(cseLclVarTyp, expTyp));

// This will contain the replacement tree for exp
// It will either be the CSE def or CSE ref
Expand Down
18 changes: 0 additions & 18 deletions tests/issues.targets
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,6 @@
<ExcludeList Include="$(XunitTestBinBase)/baseservices/varargs/varargsupport_r/*">
<Issue>Varargs supported on this platform</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/Interop/PInvoke/BestFitMapping/Char/AFT_PFT/AFT_PFT/*">
<Issue>22436</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/Interop/PInvoke/BestFitMapping/Char/Assembly_False_False/Assembly_False_False/*">
<Issue>22436</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/Interop/PInvoke/BestFitMapping/LPStr/AFT_PFT/AFT_PFT/*">
<Issue>22436</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/Interop/PInvoke/BestFitMapping/LPStr/Assembly_False_False/Assembly_False_False/*">
<Issue>22436</Issue>
</ExcludeList>
</ItemGroup>

<!-- Windows x86 specific excludes -->
Expand Down Expand Up @@ -295,12 +283,6 @@
<ExcludeList Include="$(XunitTestBinBase)/baseservices/varargs/varargsupport_r/*">
<Issue>Varargs supported on this platform</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/Interop/PInvoke/BestFitMapping/Char/AFT_PFT/AFT_PFT/*">
<Issue>22436</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/Interop/PInvoke/BestFitMapping/LPStr/AFT_PFT/AFT_PFT/*">
<Issue>22436</Issue>
</ExcludeList>
</ItemGroup>

<!-- Windows arm32 specific excludes -->
Expand Down