1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Check that a function starts with llvm. before using GET_FUNCTION_RECOGNIZER.

Fixes a use of uninitialized memory found by asan and valgind.

llvm-svn: 182480
This commit is contained in:
Rafael Espindola 2013-05-22 14:57:42 +00:00
parent 7b21915a83
commit 4aa7f7fd2b
2 changed files with 5 additions and 3 deletions

View File

@ -58,9 +58,8 @@ std::string MBlazeIntrinsicInfo::getName(unsigned IntrID, 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.'
if (!StringRef(Name, Len).startswith("llvm."))
return 0; // All intrinsics start with 'llvm.'
#define GET_FUNCTION_RECOGNIZER
#include "MBlazeGenIntrinsics.inc"

View File

@ -50,6 +50,9 @@ AMDGPUIntrinsicInfo::getName(unsigned int IntrID, Type **Tys,
unsigned int
AMDGPUIntrinsicInfo::lookupName(const char *Name, unsigned int Len) const {
if (!StringRef(Name, Len).startswith("llvm."))
return 0; // All intrinsics start with 'llvm.'
#define GET_FUNCTION_RECOGNIZER
#include "AMDGPUGenIntrinsics.inc"
#undef GET_FUNCTION_RECOGNIZER