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 /lib/IR/Value.cpp | |
parent | a6b20ced765b67a85d9219d0c8547fc9c133e14f (diff) | |
download | llvm-4c8e74f0b75cb10820c45c86399fbd02e4a8832a.tar.gz llvm-4c8e74f0b75cb10820c45c86399fbd02e4a8832a.tar.bz2 llvm-4c8e74f0b75cb10820c45c86399fbd02e4a8832a.tar.xz |
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 'lib/IR/Value.cpp')
-rw-r--r-- | lib/IR/Value.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/IR/Value.cpp b/lib/IR/Value.cpp index 5bdce2b542..adc702e05e 100644 --- a/lib/IR/Value.cpp +++ b/lib/IR/Value.cpp @@ -195,6 +195,9 @@ void Value::setName(const Twine &NewName) { if (getSymTab(this, ST)) return; // Cannot set a name on this value (e.g. constant). + if (Function *F = dyn_cast<Function>(this)) + getContext().pImpl->IntrinsicIDCache.erase(F); + if (!ST) { // No symbol table to update? Just do the change. if (NameRef.empty()) { // Free the name for this value. @@ -307,7 +310,7 @@ void Value::replaceAllUsesWith(Value *New) { // Notify all ValueHandles (if present) that this value is going away. if (HasValueHandle) ValueHandleBase::ValueIsRAUWd(this, New); - + while (!use_empty()) { Use &U = *UseList; // Must handle Constants specially, we cannot call replaceUsesOfWith on a @@ -318,10 +321,10 @@ void Value::replaceAllUsesWith(Value *New) { continue; } } - + U.set(New); } - + if (BasicBlock *BB = dyn_cast<BasicBlock>(this)) BB->replaceSuccessorsPhiUsesWith(cast<BasicBlock>(New)); } |