summaryrefslogtreecommitdiff
path: root/lib/Target/Blackfin
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2010-03-18 16:52:15 +0000
committerBob Wilson <bob.wilson@apple.com>2010-03-18 16:52:15 +0000
commit35ee7d6e045dd8488678e4d66f0ee6d052451851 (patch)
tree03b7173996f34d279b294b8291180f7cae9abf7c /lib/Target/Blackfin
parent1ac2429d1f1b89a9a9c0397ef63c4f4fa535fee8 (diff)
downloadllvm-35ee7d6e045dd8488678e4d66f0ee6d052451851.tar.gz
llvm-35ee7d6e045dd8488678e4d66f0ee6d052451851.tar.bz2
llvm-35ee7d6e045dd8488678e4d66f0ee6d052451851.tar.xz
Check if function names start with "llvm." before trying to lookup them up as
intrinsics. The intrinsic lookup code assumes that this check has been done and assumes the names are at least 6 characters long. Valgrind complained about this. pr6638. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98831 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Blackfin')
-rw-r--r--lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp b/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp
index ea9480d762..34a8d3809e 100644
--- a/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp
+++ b/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp
@@ -53,6 +53,10 @@ std::string BlackfinIntrinsicInfo::getName(unsigned IntrID, const Type **Tys,
unsigned
BlackfinIntrinsicInfo::lookupName(const char *Name, unsigned Len) const {
+ if (Len < 5 || Name[4] != '.' || Name[0] != 'l' || Name[1] != 'l'
+ || Name[2] != 'v' || Name[3] != 'm')
+ return 0; // All intrinsics start with 'llvm.'
+
#define GET_FUNCTION_RECOGNIZER
#include "BlackfinGenIntrinsics.inc"
#undef GET_FUNCTION_RECOGNIZER