In OutputString, avoid calling memcpy for really tiny strings.

This speeds up -E on 447.dealII by 5.8%

llvm-svn: 40423
This commit is contained in:
Chris Lattner 2007-07-23 06:23:07 +00:00
parent 0af9823e4d
commit 93c4ea75ec
1 changed files with 14 additions and 1 deletions

View File

@ -87,7 +87,20 @@ static void OutputString(const char *Ptr, unsigned Size) {
#else
if (OutBufCur+Size >= OutBufEnd)
FlushBuffer();
switch (Size) {
default:
memcpy(OutBufCur, Ptr, Size);
break;
case 3:
OutBufCur[2] = Ptr[2];
case 2:
OutBufCur[1] = Ptr[1];
case 1:
OutBufCur[0] = Ptr[0];
case 0:
break;
}
OutBufCur += Size;
#endif
}