[JIT] Zero constant propagation for OPCODE_SHL/OPCODE_SHR.

This commit is contained in:
gibbed 2018-11-23 08:02:09 -06:00
parent 4c04a9383a
commit 7d07720de1
1 changed files with 8 additions and 0 deletions

View File

@ -618,6 +618,10 @@ bool ConstantPropagationPass::Run(HIRBuilder* builder) {
v->set_from(i->src1.value);
v->Shl(i->src2.value);
i->Remove();
} else if (i->src2.value->IsConstantZero()) {
auto src1 = i->src1.value;
i->Replace(&OPCODE_ASSIGN_info, 0);
i->set_src1(src1);
}
break;
case OPCODE_SHR:
@ -625,6 +629,10 @@ bool ConstantPropagationPass::Run(HIRBuilder* builder) {
v->set_from(i->src1.value);
v->Shr(i->src2.value);
i->Remove();
} else if (i->src2.value->IsConstantZero()) {
auto src1 = i->src1.value;
i->Replace(&OPCODE_ASSIGN_info, 0);
i->set_src1(src1);
}
break;
case OPCODE_SHA: