Check that a function starts with llvm. before using GET_FUNCTION_RECOGNIZER.
[oota-llvm.git] / lib / Target / MBlaze / MBlazeIntrinsicInfo.cpp
index 8d262a01e706759bb6469c24357bc97eb50e9970..0d3f7d8cfe943c3d76e7ad7c3a151ea0520d982d 100644 (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"