[llvm] r358110 - GlobalISel: Fix invoke lowering creating invalid type registers
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 10 10:27:56 PDT 2019
Author: arsenm
Date: Wed Apr 10 10:27:55 2019
New Revision: 358110
URL: http://llvm.org/viewvc/llvm-project?rev=358110&view=rev
Log:
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
Modified:
llvm/trunk/include/llvm/CodeGen/GlobalISel/CallLowering.h
llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
Modified: llvm/trunk/include/llvm/CodeGen/GlobalISel/CallLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GlobalISel/CallLowering.h?rev=358110&r1=358109&r2=358110&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/CallLowering.h (original)
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/CallLowering.h Wed Apr 10 10:27:55 2019
@@ -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
Modified: llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp?rev=358110&r1=358109&r2=358110&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp Wed Apr 10 10:27:55 2019
@@ -1252,8 +1252,9 @@ bool IRTranslator::translateInvoke(const
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));
More information about the llvm-commits
mailing list