[PATCH] D60339: GlobalISel: Fix invoke lowering creating invalid type registers
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 5 14:10:31 PDT 2019
arsenm created this revision.
arsenm added reviewers: aemerson, aditya_nandakumar, paquette.
Herald added subscribers: Petar.Avramovic, volkan, kristof.beyls, rovka, wdng.
Unlike the call handling, this wasn't checking for void results and
creating a register with the invalid LLT type.
https://reviews.llvm.org/D60339
Files:
include/llvm/CodeGen/GlobalISel/CallLowering.h
lib/CodeGen/GlobalISel/IRTranslator.cpp
Index: lib/CodeGen/GlobalISel/IRTranslator.cpp
===================================================================
--- lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -1222,8 +1222,9 @@
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));
Index: include/llvm/CodeGen/GlobalISel/CallLowering.h
===================================================================
--- include/llvm/CodeGen/GlobalISel/CallLowering.h
+++ include/llvm/CodeGen/GlobalISel/CallLowering.h
@@ -49,7 +49,10 @@
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60339.193966.patch
Type: text/x-patch
Size: 1377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190405/8306d31b/attachment.bin>
More information about the llvm-commits
mailing list