From fdd089aa14d90fcf220d54fb3fbfd2170f89de78 Mon Sep 17 00:00:00 2001 From: Amara Emerson Date: Thu, 26 Jul 2018 01:25:58 +0000 Subject: [GlobalISel] Fall back to SDISel for swifterror/swiftself attributes. We don't currently support these, fall back until we do. llvm-svn: 337994 --- llvm/lib/CodeGen/GlobalISel/CallLowering.cpp | 3 +++ llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 15 +++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'llvm/lib/CodeGen') diff --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp index 114c068749e..07de31bec66 100644 --- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp +++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp @@ -38,6 +38,9 @@ bool CallLowering::lowerCall( ArgInfo OrigArg{ArgRegs[i], Arg->getType(), ISD::ArgFlagsTy{}, i < NumFixedArgs}; setArgFlags(OrigArg, i + AttributeList::FirstArgIndex, DL, CS); + // We don't currently support swifterror or swiftself args. + if (OrigArg.Flags.isSwiftError() || OrigArg.Flags.isSwiftSelf()) + return false; OrigArgs.push_back(OrigArg); ++i; } diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index d4812202498..bafb7a05536 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -1157,6 +1157,9 @@ bool IRTranslator::translateAlloca(const User &U, MachineIRBuilder &MIRBuilder) { auto &AI = cast(U); + if (AI.isSwiftError()) + return false; + if (AI.isStaticAlloca()) { unsigned Res = getOrCreateVReg(AI); int FI = getOrCreateFrameIndex(AI); @@ -1574,6 +1577,18 @@ bool IRTranslator::runOnMachineFunction(MachineFunction &CurMF) { MRI->createGenericVirtualRegister(getLLTForType(*Arg.getType(), *DL))); } + // We don't currently support translating swifterror or swiftself functions. + for (auto &Arg : F.args()) { + if (Arg.hasSwiftErrorAttr() || Arg.hasSwiftSelfAttr()) { + OptimizationRemarkMissed R("gisel-irtranslator", "GISelFailure", + F.getSubprogram(), &F.getEntryBlock()); + R << "unable to lower arguments due to swifterror/swiftself: " + << ore::NV("Prototype", F.getType()); + reportTranslationError(*MF, *TPC, *ORE, R); + return false; + } + } + if (!CLI->lowerFormalArguments(EntryBuilder, F, VRegArgs)) { OptimizationRemarkMissed R("gisel-irtranslator", "GISelFailure", F.getSubprogram(), &F.getEntryBlock()); -- cgit v1.2.3