diff options
| author | Justin Bogner <mail@justinbogner.com> | 2017-01-25 00:16:53 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2017-01-25 00:16:53 +0000 |
| commit | a029531e1075997bb1a6480d0b942350b7b875fc (patch) | |
| tree | 3a86f6aa61492a11a85692eab28b8bb753ebf792 /llvm/lib/CodeGen | |
| parent | d843cd55b590323634606225b76825280ba52539 (diff) | |
| download | bcm5719-llvm-a029531e1075997bb1a6480d0b942350b7b875fc.tar.gz bcm5719-llvm-a029531e1075997bb1a6480d0b942350b7b875fc.zip | |
GlobalISel: Use the correct types when translating landingpad instructions
There was a bug here where we were using p0 instead of s32 for the
selector type in the landingpad. Instead of hardcoding these types we
should get the types from the landingpad instruction directly.
Note that we replicate an assert from SDAG here to only support
two-valued landingpads.
llvm-svn: 292995
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index ba6db371139..23b89f3a05c 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -701,22 +701,26 @@ bool IRTranslator::translateLandingPad(const User &U, MIRBuilder.buildInstr(TargetOpcode::EH_LABEL) .addSym(MF->addLandingPad(&MBB)); + SmallVector<LLT, 2> Tys; + for (Type *Ty : cast<StructType>(LP.getType())->elements()) + Tys.push_back(LLT{*Ty, *DL}); + assert(Tys.size() == 2 && "Only two-valued landingpads are supported"); + // Mark exception register as live in. SmallVector<unsigned, 2> Regs; SmallVector<uint64_t, 2> Offsets; - LLT p0 = LLT::pointer(0, DL->getPointerSizeInBits()); if (unsigned Reg = TLI.getExceptionPointerRegister(PersonalityFn)) { - unsigned VReg = MRI->createGenericVirtualRegister(p0); + unsigned VReg = MRI->createGenericVirtualRegister(Tys[0]); MIRBuilder.buildCopy(VReg, Reg); Regs.push_back(VReg); Offsets.push_back(0); } if (unsigned Reg = TLI.getExceptionSelectorRegister(PersonalityFn)) { - unsigned VReg = MRI->createGenericVirtualRegister(p0); + unsigned VReg = MRI->createGenericVirtualRegister(Tys[1]); MIRBuilder.buildCopy(VReg, Reg); Regs.push_back(VReg); - Offsets.push_back(p0.getSizeInBits()); + Offsets.push_back(Tys[0].getSizeInBits()); } MIRBuilder.buildSequence(getOrCreateVReg(LP), Regs, Offsets); |

