1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

GlobalISel: Avoid unnecessary truncation to i64

We can just directly pass through the APInt to create a new constant.
This commit is contained in:
Matt Arsenault 2021-03-20 13:42:17 -04:00
parent 140b871148
commit 2eda243ee8

View File

@ -189,7 +189,7 @@ MachineInstrBuilder CSEMIRBuilder::buildInstr(unsigned Opc,
assert(DstOps.size() == 1 && "Invalid dsts");
if (Optional<APInt> Cst = ConstantFoldBinOp(Opc, SrcOps[0].getReg(),
SrcOps[1].getReg(), *getMRI()))
return buildConstant(DstOps[0], Cst->getSExtValue());
return buildConstant(DstOps[0], *Cst);
break;
}
case TargetOpcode::G_SEXT_INREG: {
@ -200,7 +200,7 @@ MachineInstrBuilder CSEMIRBuilder::buildInstr(unsigned Opc,
const SrcOp &Src1 = SrcOps[1];
if (auto MaybeCst =
ConstantFoldExtOp(Opc, Src0.getReg(), Src1.getImm(), *getMRI()))
return buildConstant(Dst, MaybeCst->getSExtValue());
return buildConstant(Dst, *MaybeCst);
break;
}
}