GlobalISel: Fail expansion of G_DYN_STACKALLOC for StackGrowsUp

This commit is contained in:
Matt Arsenault 2020-05-30 10:54:43 -04:00 committed by Matt Arsenault
parent 116e38fd8b
commit 3866e0a563
1 changed files with 6 additions and 3 deletions

View File

@ -5029,16 +5029,19 @@ LegalizerHelper::lowerShuffleVector(MachineInstr &MI) {
LegalizerHelper::LegalizeResult
LegalizerHelper::lowerDynStackAlloc(MachineInstr &MI) {
const auto &MF = *MI.getMF();
const auto &TFI = *MF.getSubtarget().getFrameLowering();
if (TFI.getStackGrowthDirection() == TargetFrameLowering::StackGrowsUp)
return UnableToLegalize;
Register Dst = MI.getOperand(0).getReg();
Register AllocSize = MI.getOperand(1).getReg();
Align Alignment = assumeAligned(MI.getOperand(2).getImm());
const auto &MF = *MI.getMF();
const auto &TLI = *MF.getSubtarget().getTargetLowering();
LLT PtrTy = MRI.getType(Dst);
LLT IntPtrTy = LLT::scalar(PtrTy.getSizeInBits());
const auto &TLI = *MF.getSubtarget().getTargetLowering();
Register SPReg = TLI.getStackPointerRegisterToSaveRestore();
auto SPTmp = MIRBuilder.buildCopy(PtrTy, SPReg);
SPTmp = MIRBuilder.buildCast(IntPtrTy, SPTmp);