Skip to content

Commit

Permalink
Stress
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobbotsch committed Nov 27, 2022
1 parent 0d54d2f commit c0e9751
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions src/coreclr/jit/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4664,13 +4664,13 @@ PhaseStatus Compiler::optUnrollLoops()
//
bool Compiler::optIfConvert(BasicBlock* block)
{
// Don't optimise the block if it is inside a loop
// When inside a loop, branches are quicker than selects.
// Detect via the block weight as that will be high when inside a loop.
if ((block->getBBWeight(this) > BB_UNITY_WEIGHT) && !compStressCompile(STRESS_IF_CONVERSION_INNER_LOOPS, 25))
{
return false;
}
//// Don't optimise the block if it is inside a loop
//// When inside a loop, branches are quicker than selects.
//// Detect via the block weight as that will be high when inside a loop.
//if ((block->getBBWeight(this) > BB_UNITY_WEIGHT) && !compStressCompile(STRESS_IF_CONVERSION_INNER_LOOPS, 25))
//{
// return false;
//}

// Does the block end by branching via a JTRUE after a compare?
if (block->bbJumpKind != BBJ_COND || block->NumSucc() != 2)
Expand All @@ -4682,10 +4682,10 @@ bool Compiler::optIfConvert(BasicBlock* block)
GenTree* last = block->lastStmt()->GetRootNode();
noway_assert(last->OperIs(GT_JTRUE));
GenTree* cond = last->gtGetOp1();
if (!cond->OperIsCompare())
{
return false;
}
//if (!cond->OperIsCompare())
//{
// return false;
//}

// Block where the flows merge.
BasicBlock* finalBlock = block->bbNext;
Expand Down Expand Up @@ -4803,27 +4803,27 @@ bool Compiler::optIfConvert(BasicBlock* block)
}
#endif

// Using SELECT nodes means that full assignment is always evaluated.
// Put a limit on the original source and destination of the assignment.
if (!compStressCompile(STRESS_IF_CONVERSION_COST, 25))
{
#ifdef TARGET_XARCH
JITDUMP("Skipping if-converion on xarch\n");

// xarch does not support containing relops in GT_SELECT nodes
// currently so only introduce GT_SELECT in stress.
return false;
#else
int cost = asgNode->gtGetOp2()->GetCostEx() + (gtIsLikelyRegVar(asgNode->gtGetOp1()) ? 0 : 2);

// Cost to allow for "x = cond ? a + b : x".
if (cost > 7)
{
JITDUMP("Skipping if-conversion that will evaluate RHS unconditionally at cost %d\n", cost);
return false;
}
#endif
}
// // Using SELECT nodes means that full assignment is always evaluated.
// // Put a limit on the original source and destination of the assignment.
// if (!compStressCompile(STRESS_IF_CONVERSION_COST, 25))
// {
//#ifdef TARGET_XARCH
// JITDUMP("Skipping if-converion on xarch\n");
//
// // xarch does not support containing relops in GT_SELECT nodes
// // currently so only introduce GT_SELECT in stress.
// return false;
//#else
// int cost = asgNode->gtGetOp2()->GetCostEx() + (gtIsLikelyRegVar(asgNode->gtGetOp1()) ? 0 : 2);
//
// // Cost to allow for "x = cond ? a + b : x".
// if (cost > 7)
// {
// JITDUMP("Skipping if-conversion that will evaluate RHS unconditionally at cost %d\n", cost);
// return false;
// }
//#endif
// }

// Duplicate the destination of the assign.
// This will be used as the false result of the select node.
Expand Down

0 comments on commit c0e9751

Please sign in to comment.