Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: Add stress mode for skipping lowering conditional nodes to use CPU flags #103358

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -10353,6 +10353,7 @@ class Compiler
STRESS_MODE(IF_CONVERSION_INNER_LOOPS) \
STRESS_MODE(POISON_IMPLICIT_BYREFS) \
STRESS_MODE(STORE_BLOCK_UNROLLING) \
STRESS_MODE(SKIP_COND_NODE_LOWERING) /* Don't lower conditions to use CPU flags */ \
STRESS_MODE(COUNT)

enum compStressArea
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/jit/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4313,6 +4313,14 @@ bool Lowering::TryLowerConditionToFlagsNode(GenTree* parent, GenTree* condition,
DISPTREERANGE(BlockRange(), condition);
JITDUMP("\n");

#ifdef DEBUG
if (comp->compStressCompile(Compiler::STRESS_SKIP_COND_NODE_LOWERING, 50))
{
JITDUMP("JitStress: skip lowering attempt\n");
return false;
}
#endif // DEBUG
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

50% of methods seems a bit high given the frequency of conditional branches.. maybe something like 10% is sufficient?

Nit: the ifdef is unnecessary, there is a release version of compStressCompile that always returns false (but feel free to leave it if you prefer to make it more visible that this is debug-only).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, I'll update it.


if (condition->OperIsCompare())
{
if (!IsInvariantInRange(condition, parent))
Expand Down
Loading