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

Reid Spencer reid at x10sys.com
Sun Apr 15 23:55:05 PDT 2007



Changes in directory llvm/lib/VMCore:

Function.cpp updated: 1.118 -> 1.119
---
Log message:

For PR1328: http://llvm.org/PR1328 :
Don't assert everytime an intrinsic name isn't recognized. Instead, make
the assert optional when callin getIntrinsicID(). This allows the assembler
to handle invalid intrinsic names gracefully.


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

 Function.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/VMCore/Function.cpp
diff -u llvm/lib/VMCore/Function.cpp:1.118 llvm/lib/VMCore/Function.cpp:1.119
--- llvm/lib/VMCore/Function.cpp:1.118	Tue Apr 10 21:44:19 2007
+++ llvm/lib/VMCore/Function.cpp	Mon Apr 16 01:54:34 2007
@@ -224,20 +224,21 @@
 /// particular intrinsic functions which correspond to this value are defined in
 /// llvm/Intrinsics.h.
 ///
-unsigned Function::getIntrinsicID() const {
+unsigned Function::getIntrinsicID(bool noAssert) const {
   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'
+  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(Len != 5 && "'llvm.' is an invalid intrinsic name!");
+  assert((Len != 5 || noAssert) && "'llvm.' is an invalid intrinsic name!");
 
 #define GET_FUNCTION_RECOGNIZER
 #include "llvm/Intrinsics.gen"
 #undef GET_FUNCTION_RECOGNIZER
+  assert(noAssert && "Invalid LLVM intrinsic name");
   return 0;
 }
 






More information about the llvm-commits mailing list