constant_propagation_pass: Fold IsZero
This commit is contained in:
parent
df1a0eecaf
commit
d51a83d265
1 changed files with 10 additions and 0 deletions
|
@ -337,6 +337,16 @@ void ConstantPropagation(IR::Block& block) {
|
||||||
case Op::MostSignificantBit:
|
case Op::MostSignificantBit:
|
||||||
FoldMostSignificantBit(inst);
|
FoldMostSignificantBit(inst);
|
||||||
break;
|
break;
|
||||||
|
case Op::IsZero32:
|
||||||
|
if (inst.AreAllArgsImmediates()) {
|
||||||
|
inst.ReplaceUsesWith(IR::Value{inst.GetArg(0).GetU32() == 0});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Op::IsZero64:
|
||||||
|
if (inst.AreAllArgsImmediates()) {
|
||||||
|
inst.ReplaceUsesWith(IR::Value{inst.GetArg(0).GetU64() == 0});
|
||||||
|
}
|
||||||
|
break;
|
||||||
case Op::LogicalShiftLeft32:
|
case Op::LogicalShiftLeft32:
|
||||||
if (FoldShifts(inst)) {
|
if (FoldShifts(inst)) {
|
||||||
ReplaceUsesWith(inst, true, Safe::LogicalShiftLeft<u32>(inst.GetArg(0).GetU32(), inst.GetArg(1).GetU8()));
|
ReplaceUsesWith(inst, true, Safe::LogicalShiftLeft<u32>(inst.GetArg(0).GetU32(), inst.GetArg(1).GetU8()));
|
||||||
|
|
Loading…
Reference in a new issue