GlobalISel: Fix invoke lowering creating invalid type registers

Unlike the call handling, this wasn't checking for void results and
creating a register with the invalid LLT

llvm-svn: 358110
This commit is contained in:
Matt Arsenault 2019-04-10 17:27:55 +00:00
parent 7187272b2b
commit 0aab99902b
2 changed files with 7 additions and 3 deletions

View File

@ -49,7 +49,10 @@ public:
ArgInfo(unsigned Reg, Type *Ty, ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy{},
bool IsFixed = true)
: Reg(Reg), Ty(Ty), Flags(Flags), IsFixed(IsFixed) {}
: Reg(Reg), Ty(Ty), Flags(Flags), IsFixed(IsFixed) {
assert((Ty->isVoidTy() == (Reg == 0)) &&
"only void types should have no register");
}
};
/// Argument handling is mostly uniform between the four places that

View File

@ -1252,8 +1252,9 @@ bool IRTranslator::translateInvoke(const User &U,
MCSymbol *BeginSymbol = Context.createTempSymbol();
MIRBuilder.buildInstr(TargetOpcode::EH_LABEL).addSym(BeginSymbol);
unsigned Res =
MRI->createGenericVirtualRegister(getLLTForType(*I.getType(), *DL));
unsigned Res = 0;
if (!I.getType()->isVoidTy())
Res = MRI->createGenericVirtualRegister(getLLTForType(*I.getType(), *DL));
SmallVector<unsigned, 8> Args;
for (auto &Arg: I.arg_operands())
Args.push_back(packRegs(*Arg, MIRBuilder));