summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2019-12-02 16:42:33 -0800
committerReid Kleckner <rnk@google.com>2020-01-03 11:27:41 -0800
commit9c2b72821be64db7795dd18586c2ae7edb905c21 (patch)
treef80ab96f0c8ee84a36f5a08399f5ed73c2d07e9f /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
parente5a56f2d50ce1939eba4fddbeb9c8e032db4fc95 (diff)
downloadbcm5719-llvm-9c2b72821be64db7795dd18586c2ae7edb905c21.tar.gz
bcm5719-llvm-9c2b72821be64db7795dd18586c2ae7edb905c21.zip
Move tail call disabling code to target independent code
When the "disable-tail-calls" attribute was added, checks were added for it in various backends. Now this code has proliferated, and it is something the target is responsible for checking. Move that responsibility back to the ISels (fast, global, and SD). There's no major functionality change, except for targets that never implemented this check. This LLVM attribute was originally added in d9699bc7bdf0362173fcd256690f61a4d47429c2 (2015). Reviewers: echristo, MaskRay Differential Revision: https://reviews.llvm.org/D72118
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 1049a897c6f..9d33c53dd4f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -52,6 +52,10 @@ bool TargetLowering::isInTailCallPosition(SelectionDAG &DAG, SDNode *Node,
SDValue &Chain) const {
const Function &F = DAG.getMachineFunction().getFunction();
+ // First, check if tail calls have been disabled in this function.
+ if (F.getFnAttribute("disable-tail-calls").getValueAsString() == "true")
+ return false;
+
// Conservatively require the attributes of the call to match those of
// the return. Ignore NoAlias and NonNull because they don't affect the
// call sequence.
OpenPOWER on IntegriCloud