More fold C1 substitutability check for identical operands

This commit is contained in:
Daisuke Yamazaki 2026-07-07 00:06:33 +09:00
parent 9cab9a5936
commit 8e063f4519
2 changed files with 10 additions and 5 deletions

View File

@ -1594,14 +1594,14 @@ void LIR_Assembler::emit_opSubstitutabilityCheck(LIR_OpSubstitutabilityCheck* op
Register left = op->left()->as_register();
Register right = op->right()->as_register();
if (left == right) {
__ jmp(L_oops_equal);
} else {
__ cmpptr(left, right);
__ jcc(Assembler::equal, L_oops_equal);
move(op->equal_result(), op->result_opr());
return;
}
__ cmpptr(left, right);
__ jcc(Assembler::equal, L_oops_equal);
// (1) Null check -- if one of the operands is null, the other must not be null (because
// the two references are not equal), so they are not substitutable,
__ testptr(left, left);

View File

@ -3363,6 +3363,11 @@ void LIRGenerator::substitutability_check(If* x, LIRItem& left, LIRItem& right)
void LIRGenerator::substitutability_check_common(Value left_val, Value right_val, LIRItem& left, LIRItem& right,
LIR_Opr equal_result, LIR_Opr not_equal_result, LIR_Opr result,
CodeEmitInfo* info) {
if (left.result() == right.result()) {
__ move(equal_result, result);
return;
}
LIR_Opr tmp1 = LIR_OprFact::illegalOpr;
LIR_Opr tmp2 = LIR_OprFact::illegalOpr;