mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 01:19:28 +01:00
8353041: NeverBranchNode causes incorrect block frequency calculation
Reviewed-by: thartmann, rcastanedalo
This commit is contained in:
@@ -233,9 +233,21 @@ uint Block_Stack::most_frequent_successor( Block *b ) {
|
|||||||
case Op_Jump:
|
case Op_Jump:
|
||||||
case Op_Root:
|
case Op_Root:
|
||||||
case Op_Goto:
|
case Op_Goto:
|
||||||
case Op_NeverBranch:
|
|
||||||
freq_idx = 0; // fall thru
|
freq_idx = 0; // fall thru
|
||||||
break;
|
break;
|
||||||
|
case Op_NeverBranch: {
|
||||||
|
Node* succ = n->as_NeverBranch()->proj_out(0)->unique_ctrl_out();
|
||||||
|
int succ_idx = 0; // normal case
|
||||||
|
if (succ == b->_succs[1]->head()) {
|
||||||
|
// Edges swapped, rare case. May happen due to an unusual matcher
|
||||||
|
// traversal order for peeled infinite loops.
|
||||||
|
succ_idx = 1;
|
||||||
|
} else {
|
||||||
|
assert(succ == b->_succs[0]->head(), "succ not found");
|
||||||
|
}
|
||||||
|
freq_idx = succ_idx;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case Op_TailCall:
|
case Op_TailCall:
|
||||||
case Op_TailJump:
|
case Op_TailJump:
|
||||||
case Op_ForwardException:
|
case Op_ForwardException:
|
||||||
|
|||||||
@@ -2160,8 +2160,13 @@ float Block::succ_prob(uint i) {
|
|||||||
// Pass frequency straight thru to target
|
// Pass frequency straight thru to target
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
|
|
||||||
case Op_NeverBranch:
|
case Op_NeverBranch: {
|
||||||
|
Node* succ = n->as_NeverBranch()->proj_out(0)->unique_ctrl_out();
|
||||||
|
if (_succs[i]->head() == succ) {
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
case Op_TailCall:
|
case Op_TailCall:
|
||||||
case Op_TailJump:
|
case Op_TailJump:
|
||||||
|
|||||||
Reference in New Issue
Block a user