diff options
author | Michael Ilseman <milseman@apple.com> | 2013-03-01 18:48:54 +0000 |
---|---|---|
committer | Michael Ilseman <milseman@apple.com> | 2013-03-01 18:48:54 +0000 |
commit | 4c8e74f0b75cb10820c45c86399fbd02e4a8832a (patch) | |
tree | cc1f1cdb45bee8daff09970eaa0d992d952b6edf /include/llvm/IR/Function.h | |
parent | a6b20ced765b67a85d9219d0c8547fc9c133e14f (diff) |
Cache the result of Function::getIntrinsicID() in a DenseMap attached to the LLVMContext.
This reduces the time actually spent doing string to ID conversion and shows a 10% improvement in compile time for a particularly bad case that involves ARM Neon intrinsics (these have many overloads).
Patch by Jean-Luc Duprat!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176365 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/IR/Function.h')
-rw-r--r-- | include/llvm/IR/Function.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/llvm/IR/Function.h b/include/llvm/IR/Function.h index 568b55c87b..a7dea5ca3d 100644 --- a/include/llvm/IR/Function.h +++ b/include/llvm/IR/Function.h @@ -113,6 +113,10 @@ private: Function(const Function&) LLVM_DELETED_FUNCTION; void operator=(const Function&) LLVM_DELETED_FUNCTION; + /// Do the actual lookup of an intrinsic ID when the query could not be + /// answered from the cache. + unsigned lookupIntrinsicID() const LLVM_READONLY; + /// Function ctor - If the (optional) Module argument is specified, the /// function is automatically inserted into the end of the function list for /// the module. @@ -141,10 +145,12 @@ public: /// getIntrinsicID - This method returns the ID number of the specified /// function, or Intrinsic::not_intrinsic if the function is not an - /// instrinsic, or if the pointer is null. This value is always defined to be + /// intrinsic, or if the pointer is null. This value is always defined to be /// zero to allow easy checking for whether a function is intrinsic or not. /// The particular intrinsic functions which correspond to this value are - /// defined in llvm/Intrinsics.h. + /// defined in llvm/Intrinsics.h. Results are cached in the LLVM context, + /// subsequent requests for the same ID return results much faster from the + /// cache. /// unsigned getIntrinsicID() const LLVM_READONLY; bool isIntrinsic() const { return getName().startswith("llvm."); } |