[llvm-commits] [llvm] r98831 - in /llvm/trunk/lib/Target: Blackfin/BlackfinIntrinsicInfo.cpp MBlaze/MBlazeIntrinsicInfo.cpp

Bob Wilson bob.wilson at apple.com
Thu Mar 18 09:52:15 PDT 2010


Author: bwilson
Date: Thu Mar 18 11:52:15 2010
New Revision: 98831

URL: http://llvm.org/viewvc/llvm-project?rev=98831&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp
    llvm/trunk/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp

Modified: llvm/trunk/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp?rev=98831&r1=98830&r2=98831&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp (original)
+++ llvm/trunk/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp Thu Mar 18 11:52:15 2010
@@ -53,6 +53,10 @@
 
 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

Modified: llvm/trunk/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp?rev=98831&r1=98830&r2=98831&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp (original)
+++ llvm/trunk/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp Thu Mar 18 11:52:15 2010
@@ -57,6 +57,10 @@
 
 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





More information about the llvm-commits mailing list