diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2007-04-16 06:54:34 +0000 |
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2007-04-16 06:54:34 +0000 |
| commit | 9c2eec377ec079c605f662ba49e4be94c39ed01e (patch) | |
| tree | eebd3f7a861548c0761d5de99b3f7b4f1ffe0456 /llvm/lib/VMCore | |
| parent | f400745e7f5bed8ae1eea0dd8bc6b5067d77a2b4 (diff) | |
| download | bcm5719-llvm-9c2eec377ec079c605f662ba49e4be94c39ed01e.tar.gz bcm5719-llvm-9c2eec377ec079c605f662ba49e4be94c39ed01e.zip | |
For 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.
llvm-svn: 36120
Diffstat (limited to 'llvm/lib/VMCore')
| -rw-r--r-- | llvm/lib/VMCore/Function.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp index e2a015fabbb..5176a05d760 100644 --- a/llvm/lib/VMCore/Function.cpp +++ b/llvm/lib/VMCore/Function.cpp @@ -224,20 +224,21 @@ void Function::dropAllReferences() { /// 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; } |

