summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-10-08 23:18:30 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-10-08 23:18:30 +0000
commitc21a05a3a473ead8e092a2b3d6e4c93a647e4863 (patch)
tree1c567fdab63a92ea698c1c469559fddaf36c9679 /llvm/lib/Transforms/Utils/Local.cpp
parent1ede5367ba23446bb01c9006dcbd6978d71f7f82 (diff)
downloadbcm5719-llvm-c21a05a3a473ead8e092a2b3d6e4c93a647e4863.tar.gz
bcm5719-llvm-c21a05a3a473ead8e092a2b3d6e4c93a647e4863.zip
[PlaceSafeopints] Extract out `callsGCLeafFunction`, NFC
Summary: This will be used in a later change to RewriteStatepointsForGC. Reviewers: reames, swaroop.sridhar Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D13490 llvm-svn: 249777
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 5be5a7df26b..de04ea506ce 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1480,3 +1480,20 @@ unsigned llvm::replaceDominatedUsesWith(Value *From, Value *To,
}
return Count;
}
+
+bool llvm::callsGCLeafFunction(ImmutableCallSite CS) {
+ if (isa<IntrinsicInst>(CS.getInstruction()))
+ // Most LLVM intrinsics are things which can never take a safepoint.
+ // As a result, we don't need to have the stack parsable at the
+ // callsite. This is a highly useful optimization since intrinsic
+ // calls are fairly prevalent, particularly in debug builds.
+ return true;
+
+ // Check if the function is specifically marked as a gc leaf function.
+ //
+ // TODO: we should be checking the attributes on the call site as well.
+ if (const Function *F = CS.getCalledFunction())
+ return F->hasFnAttribute("gc-leaf-function");
+
+ return false;
+}
OpenPOWER on IntegriCloud