[cfe-commits] r40423 - /cfe/trunk/Driver/PrintPreprocessedOutput.cpp
Chris Lattner
sabre at nondot.org
Sun Jul 22 23:23:07 PDT 2007
Author: lattner
Date: Mon Jul 23 01:23:07 2007
New Revision: 40423
URL: http://llvm.org/viewvc/llvm-project?rev=40423&view=rev
Log:
In OutputString, avoid calling memcpy for really tiny strings.
This speeds up -E on 447.dealII by 5.8%
Modified:
cfe/trunk/Driver/PrintPreprocessedOutput.cpp
Modified: cfe/trunk/Driver/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/PrintPreprocessedOutput.cpp?rev=40423&r1=40422&r2=40423&view=diff
==============================================================================
--- cfe/trunk/Driver/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/Driver/PrintPreprocessedOutput.cpp Mon Jul 23 01:23:07 2007
@@ -87,7 +87,20 @@
#else
if (OutBufCur+Size >= OutBufEnd)
FlushBuffer();
- memcpy(OutBufCur, Ptr, Size);
+
+ 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
}
More information about the cfe-commits
mailing list