diff options
author | Chris Lattner <sabre@nondot.org> | 2007-02-15 19:17:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-02-15 19:17:16 +0000 |
commit | 3b515802f652b16b05c9a8f344d219a0739b36a3 (patch) | |
tree | 876bfac32a34247ea7b635ef30d4659a4759c9f0 /lib/VMCore/Function.cpp | |
parent | 638417f7887303b8dcf75043b39182de4c96db55 (diff) |
Implement Function::getIntrinsicID without it needing to call Value::getName,
which allocates a string. This speeds up instcombine on 447.dealII by 5%.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Function.cpp')
-rw-r--r-- | lib/VMCore/Function.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index fcbf73f9cf..8aa0caa854 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -160,12 +160,15 @@ void Function::dropAllReferences() { /// llvm/Intrinsics.h. /// unsigned Function::getIntrinsicID() const { - const std::string& Name = this->getName(); - if (Name.size() < 5 || Name[4] != '.' || Name[0] != 'l' || Name[1] != 'l' + const ValueName *ValName = this->getValueName(); + unsigned Len = ValName->getKeyLength(); + const char *Name = ValName->getKeyData(); + + if (Len < 5 || Name[4] != '.' || Name[0] != 'l' || Name[1] != 'l' || Name[2] != 'v' || Name[3] != 'm') return 0; // All intrinsics start with 'llvm.' - assert(Name.size() != 5 && "'llvm.' is an invalid intrinsic name!"); + assert(Len != 5 && "'llvm.' is an invalid intrinsic name!"); #define GET_FUNCTION_RECOGNIZER #include "llvm/Intrinsics.gen" |