summaryrefslogtreecommitdiffstats
path: root/llvm
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
commitce51f782ddbdd823cc87f490da8ae33cb1e8334a (patch)
tree8826e5136df54721d93064d92036dd1e12c17666 /llvm
parent0b39f10d1010eb30acf1c4aadfd958188cb978fb (diff)
downloadbcm5719-llvm-ce51f782ddbdd823cc87f490da8ae33cb1e8334a.tar.gz
bcm5719-llvm-ce51f782ddbdd823cc87f490da8ae33cb1e8334a.zip
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. llvm-svn: 98831
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp4
-rw-r--r--llvm/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp4
2 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp b/llvm/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp
index ea9480d7625..34a8d3809ea 100644
--- a/llvm/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp
+++ b/llvm/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
diff --git a/llvm/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp b/llvm/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp
index c8faffc8452..4931860912a 100644
--- a/llvm/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp
+++ b/llvm/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp
@@ -57,6 +57,10 @@ std::string MBlazeIntrinsicInfo::getName(unsigned IntrID, const Type **Tys,
unsigned MBlazeIntrinsicInfo::
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 "MBlazeGenIntrinsics.inc"
#undef GET_FUNCTION_RECOGNIZER
OpenPOWER on IntegriCloud