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 | 1e92e0677924e18ecbb68f403067778b33e9c59c (patch) | |
| tree | 55414da1a962d823cd39c6f87b6575ff2b5ff4db /llvm/lib | |
| parent | 62615e233d3d83acaf21b1addfb067ad4c293c02 (diff) | |
| download | llvm-1e92e0677924e18ecbb68f403067778b33e9c59c.zip llvm-1e92e0677924e18ecbb68f403067778b33e9c59c.tar.gz llvm-1e92e0677924e18ecbb68f403067778b33e9c59c.tar.bz2 | |
Implement Function::getIntrinsicID without it needing to call Value::getName,
which allocates a string. This speeds up instcombine on 447.dealII by 5%.
llvm-svn: 34318
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/VMCore/Function.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp index fcbf73f..8aa0caa 100644 --- a/llvm/lib/VMCore/Function.cpp +++ b/llvm/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" |
