8142314: Bug in C1 ControlFlowOptimizer::delete_unnecessary_jumps with bytecode profiling
Reviewed-by: kvn
This commit is contained in:
parent
ac09d8a135
commit
bace7d99aa
@ -2004,7 +2004,7 @@ void LIR_OpRoundFP::print_instr(outputStream* out) const {
|
||||
|
||||
// LIR_Op2
|
||||
void LIR_Op2::print_instr(outputStream* out) const {
|
||||
if (code() == lir_cmove) {
|
||||
if (code() == lir_cmove || code() == lir_cmp) {
|
||||
print_condition(out, condition()); out->print(" ");
|
||||
}
|
||||
in_opr1()->print(out); out->print(" ");
|
||||
|
@ -6233,9 +6233,19 @@ void ControlFlowOptimizer::delete_unnecessary_jumps(BlockList* code) {
|
||||
if (prev_branch->stub() == NULL) {
|
||||
|
||||
LIR_Op2* prev_cmp = NULL;
|
||||
// There might be a cmove inserted for profiling which depends on the same
|
||||
// compare. If we change the condition of the respective compare, we have
|
||||
// to take care of this cmove as well.
|
||||
LIR_Op2* prev_cmove = NULL;
|
||||
|
||||
for(int j = instructions->length() - 3; j >= 0 && prev_cmp == NULL; j--) {
|
||||
prev_op = instructions->at(j);
|
||||
// check for the cmove
|
||||
if (prev_op->code() == lir_cmove) {
|
||||
assert(prev_op->as_Op2() != NULL, "cmove must be of type LIR_Op2");
|
||||
prev_cmove = (LIR_Op2*)prev_op;
|
||||
assert(prev_branch->cond() == prev_cmove->condition(), "should be the same");
|
||||
}
|
||||
if (prev_op->code() == lir_cmp) {
|
||||
assert(prev_op->as_Op2() != NULL, "branch must be of type LIR_Op2");
|
||||
prev_cmp = (LIR_Op2*)prev_op;
|
||||
@ -6252,6 +6262,13 @@ void ControlFlowOptimizer::delete_unnecessary_jumps(BlockList* code) {
|
||||
prev_branch->negate_cond();
|
||||
prev_cmp->set_condition(prev_branch->cond());
|
||||
instructions->truncate(instructions->length() - 1);
|
||||
// if we do change the condition, we have to change the cmove as well
|
||||
if (prev_cmove != NULL) {
|
||||
prev_cmove->set_condition(prev_branch->cond());
|
||||
LIR_Opr t = prev_cmove->in_opr1();
|
||||
prev_cmove->set_in_opr1(prev_cmove->in_opr2());
|
||||
prev_cmove->set_in_opr2(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user