summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorAmara Emerson <aemerson@apple.com>2018-07-26 01:25:58 +0000
committerAmara Emerson <aemerson@apple.com>2018-07-26 01:25:58 +0000
commitfdd089aa14d90fcf220d54fb3fbfd2170f89de78 (patch)
tree525d7c3ef2cf65af43b4fb1bb1fa616638bc8cc2 /llvm/lib/CodeGen
parent1d56b4ae40c6dc7bbf6ec6917c986ae5210d1b70 (diff)
downloadbcm5719-llvm-fdd089aa14d90fcf220d54fb3fbfd2170f89de78.tar.gz
bcm5719-llvm-fdd089aa14d90fcf220d54fb3fbfd2170f89de78.zip
[GlobalISel] Fall back to SDISel for swifterror/swiftself attributes.
We don't currently support these, fall back until we do. llvm-svn: 337994
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/CallLowering.cpp3
-rw-r--r--llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp15
2 files changed, 18 insertions, 0 deletions
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<AllocaInst>(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());
OpenPOWER on IntegriCloud