diff options
author | Tim Northover <t.p.northover@gmail.com> | 2021-02-10 14:35:16 +0000 |
---|---|---|
committer | Tim Northover <t.p.northover@gmail.com> | 2021-05-28 11:12:00 +0100 |
commit | 9ff2eb1ea596a52ad2b5cfab826548c3af0a1e6e (patch) | |
tree | e3ec85d67b6cffa32fe93ee23d2b6548dd0a4d1a /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | |
parent | d88f96dff3f192fc0c1bf57f7810b95a709b3591 (diff) | |
download | llvm-9ff2eb1ea596a52ad2b5cfab826548c3af0a1e6e.zip llvm-9ff2eb1ea596a52ad2b5cfab826548c3af0a1e6e.tar.gz llvm-9ff2eb1ea596a52ad2b5cfab826548c3af0a1e6e.tar.bz2 |
SwiftTailCC: teach verifier musttail rules applicable to this CC.
SwiftTailCC has a different set of requirements than the C calling convention
for a tail call. The exact argument sequence doesn't have to match, but fewer
ABI-affecting attributes are allowed.
Also make sure the musttail diagnostic triggers if a musttail call isn't
actually a tail call.
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 08ca62b..ab77ef4 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -2924,7 +2924,7 @@ void SelectionDAGBuilder::visitInvoke(const InvokeInst &I) { // with deopt state. LowerCallSiteWithDeoptBundle(&I, getValue(Callee), EHPadBB); } else { - LowerCallTo(I, getValue(Callee), false, EHPadBB); + LowerCallTo(I, getValue(Callee), false, false, EHPadBB); } // If the value of the invoke is used outside of its defining block, make it @@ -5734,7 +5734,7 @@ void SelectionDAGBuilder::lowerCallToExternalSymbol(const CallInst &I, SDValue Callee = DAG.getExternalSymbol( FunctionName, DAG.getTargetLoweringInfo().getPointerTy(DAG.getDataLayout())); - LowerCallTo(I, Callee, I.isTailCall()); + LowerCallTo(I, Callee, I.isTailCall(), I.isMustTailCall()); } /// Given a @llvm.call.preallocated.setup, return the corresponding @@ -7420,6 +7420,7 @@ SelectionDAGBuilder::lowerInvokable(TargetLowering::CallLoweringInfo &CLI, void SelectionDAGBuilder::LowerCallTo(const CallBase &CB, SDValue Callee, bool isTailCall, + bool isMustTailCall, const BasicBlock *EHPadBB) { auto &DL = DAG.getDataLayout(); FunctionType *FTy = CB.getFunctionType(); @@ -7436,7 +7437,7 @@ void SelectionDAGBuilder::LowerCallTo(const CallBase &CB, SDValue Callee, // attribute. auto *Caller = CB.getParent()->getParent(); if (Caller->getFnAttribute("disable-tail-calls").getValueAsString() == - "true") + "true" && !isMustTailCall) isTailCall = false; // We can't tail call inside a function with a swifterror argument. Lowering @@ -8060,7 +8061,7 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) { // Check if we can potentially perform a tail call. More detailed checking // is be done within LowerCallTo, after more information about the call is // known. - LowerCallTo(I, Callee, I.isTailCall()); + LowerCallTo(I, Callee, I.isTailCall(), I.isMustTailCall()); } namespace { |