Skip to content

Commit

Permalink
Limit optSwitchConvert to TYP_INT/TYP_LONG (dotnet#95608)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo authored Dec 5, 2023
1 parent 6249fd2 commit a954681
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/coreclr/jit/switchrecognition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ bool IsConstantTestCondBlock(const BasicBlock* block,
GenTree* op1 = rootNode->gtGetOp1()->gtGetOp1();
GenTree* op2 = rootNode->gtGetOp1()->gtGetOp2();

if (!varTypeIsIntegral(op1) || !varTypeIsIntegral(op2))
if (!varTypeIsIntOrI(op1) || !varTypeIsIntOrI(op2))
{
// Only integral types are supported
// Only TYP_INT and TYP_LONG are supported
return false;
}

Expand Down Expand Up @@ -253,6 +253,7 @@ bool Compiler::optSwitchDetectAndConvert(BasicBlock* firstBlock)
bool Compiler::optSwitchConvert(BasicBlock* firstBlock, int testsCount, ssize_t* testValues, GenTree* nodeToTest)
{
assert(firstBlock->KindIs(BBJ_COND));
assert(!varTypeIsSmall(nodeToTest));

if (testsCount < SWITCH_MIN_TESTS)
{
Expand Down

0 comments on commit a954681

Please sign in to comment.