diff options
author | Tim Northover <tnorthover@apple.com> | 2017-01-30 20:52:42 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2017-01-30 20:52:42 +0000 |
commit | c94497048434ede852fe3db7870ba97864d8e1bf (patch) | |
tree | 04dca2abe97ac1a6be3de0bdbe5b0c9c49ae9ded /llvm/lib/CodeGen | |
parent | c94d70336b2a66606620f03231e77211ac524c5e (diff) | |
download | bcm5719-llvm-c94497048434ede852fe3db7870ba97864d8e1bf.tar.gz bcm5719-llvm-c94497048434ede852fe3db7870ba97864d8e1bf.zip |
GlobalISel: account for differing exception selector sizes.
For some reason the exception selector register must be a pointer (that's
assumed by SDag); on the other hand, it gets moved into an IR-level type which
might be entirely different (i32 on AArch64). IRTranslator needs to be aware of
this.
llvm-svn: 293546
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index 3a2469dca49..21657827a93 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -801,8 +801,17 @@ bool IRTranslator::translateLandingPad(const User &U, if (unsigned Reg = TLI.getExceptionSelectorRegister(PersonalityFn)) { MBB.addLiveIn(Reg); + + // N.b. the exception selector register always has pointer type and may not + // match the actual IR-level type in the landingpad so an extra cast is + // needed. + unsigned PtrVReg = MRI->createGenericVirtualRegister(Tys[0]); + MIRBuilder.buildCopy(PtrVReg, Reg); + unsigned VReg = MRI->createGenericVirtualRegister(Tys[1]); - MIRBuilder.buildCopy(VReg, Reg); + MIRBuilder.buildInstr(TargetOpcode::G_PTRTOINT) + .addDef(VReg) + .addUse(PtrVReg); Regs.push_back(VReg); Offsets.push_back(Tys[0].getSizeInBits()); } |