[llvm-commits] CVS: llvm/lib/VMCore/Function.cpp

Chris Lattner sabre at nondot.org
Thu Feb 15 11:17:35 PST 2007



Changes in directory llvm/lib/VMCore:

Function.cpp updated: 1.113 -> 1.114
---
Log message:

Implement Function::getIntrinsicID without it needing to call Value::getName,
which allocates a string.  This speeds up instcombine on 447.dealII by 5%.


---
Diffs of the changes:  (+6 -3)

 Function.cpp |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)


Index: llvm/lib/VMCore/Function.cpp
diff -u llvm/lib/VMCore/Function.cpp:1.113 llvm/lib/VMCore/Function.cpp:1.114
--- llvm/lib/VMCore/Function.cpp:1.113	Sun Feb 11 23:18:08 2007
+++ llvm/lib/VMCore/Function.cpp	Thu Feb 15 13:17:16 2007
@@ -160,12 +160,15 @@
 /// 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"






More information about the llvm-commits mailing list