summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2016-08-18 18:30:54 +0000
committerPete Cooper <peter_cooper@apple.com>2016-08-18 18:30:54 +0000
commita8db71e8407922ab7e2e8279e59749d8ce222e0d (patch)
tree998f2dbb444ef4766f0f9d46dc2402a0879d6d8d /llvm/lib/IR/Function.cpp
parentc33b837af399c75bc1dec0aaa1d5b3944964b1c6 (diff)
downloadbcm5719-llvm-a8db71e8407922ab7e2e8279e59749d8ce222e0d.tar.gz
bcm5719-llvm-a8db71e8407922ab7e2e8279e59749d8ce222e0d.zip
Add a version of Intrinsic::getName which is more efficient when there are no overloads.
When running 'opt -O2 verify-uselistorder-nodbg.lto.bc', there are 33m allocations. 8.2m come from std::string allocations in Intrinsic::getName(). Turns out this method only returns a std::string because it needs to handle overloads, but that is not the common case. This adds an overload of getName which just returns a StringRef when there are no overloads and so saves on the allocations. llvm-svn: 279113
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index f1546f17d9e..90f94e696f3 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -551,6 +551,11 @@ static std::string getMangledTypeStr(Type* Ty) {
return Result;
}
+StringRef Intrinsic::getName(ID id) {
+ assert(id < num_intrinsics && "Invalid intrinsic ID!");
+ return IntrinsicNameTable[id];
+}
+
std::string Intrinsic::getName(ID id, ArrayRef<Type*> Tys) {
assert(id < num_intrinsics && "Invalid intrinsic ID!");
std::string Result(IntrinsicNameTable[id]);
OpenPOWER on IntegriCloud