Skip to content

Commit 62ad104

Browse files
committed
Disable for arm, no meaningful diffs anyway
1 parent 0e06dc9 commit 62ad104

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/coreclr/jit/switchrecognition.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
// We mainly rely on TryLowerSwitchToBitTest in these heuristics, but jump tables can be useful
1010
// even without conversion to a bitmap test.
1111
#define SWITCH_MAX_DISTANCE ((TARGET_POINTER_SIZE * BITS_IN_BYTE) - 1)
12-
#define SWITCH_MIN_TESTS 4
12+
#define SWITCH_MIN_TESTS 3
1313

1414
//-----------------------------------------------------------------------------
15-
// optSwitchRecognition: Optimize range check for if (A || B || C || D) pattern and convert it to Switch block
15+
// optSwitchRecognition: Optimize range check for `x == cns1 || x == cns2 || x == cns3 ...`
16+
// pattern and convert it to Switch block (jump table) which is then *might* be converted
17+
// to a bitmap test via TryLowerSwitchToBitTest.
18+
// TODO: recognize general jump table patterns.
1619
//
17-
// Returns:
18-
// MODIFIED_NOTHING if no optimization is performed.
19-
// MODIFIED_EVERYTHING otherwise.
20-
//
21-
// Notes:
22-
// Detect if (a == val1 || a == val2 || a == val3 || ...) pattern and change it to switch tree
23-
// to reduce compares and jumps, and perform bit operation instead in Lowering phase.
24-
// This optimization is performed only for integer types.
20+
// Return Value:
21+
// MODIFIED_EVERYTHING if the optimization was applied.
2522
//
2623
PhaseStatus Compiler::optSwitchRecognition()
2724
{
25+
// Limit to XARCH, ARM is already doing a great job with such comparisons using
26+
// a series of ccmp instruction (see ifConvert phase).
27+
#ifdef TARGET_XARCH
2828
bool modified = false;
2929
for (BasicBlock* block = fgFirstBB; block != nullptr; block = block->bbNext)
3030
{
@@ -41,7 +41,7 @@ PhaseStatus Compiler::optSwitchRecognition()
4141
fgUpdateChangedFlowGraph(FlowGraphUpdates::COMPUTE_BASICS);
4242
return PhaseStatus::MODIFIED_EVERYTHING;
4343
}
44-
44+
#endif
4545
return PhaseStatus::MODIFIED_NOTHING;
4646
}
4747

0 commit comments

Comments
 (0)