From b372c1114c1eeffbd1a3f6ddc5d33e77564bfee2 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 17 Mar 2009 21:15:18 +0000 Subject: Add BUILTIN_EXPECT Support/Compiler macro. - Use for exceptional buffer conditions in raw_ostream:write to shave off a cycle or two. - Please rename if you have a better one. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67103 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/raw_ostream.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/Support/raw_ostream.cpp') diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 639d6fa..f62a31d 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -16,6 +16,7 @@ #include "llvm/System/Program.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Config/config.h" +#include "llvm/Support/Compiler.h" #include #if defined(HAVE_UNISTD_H) @@ -142,7 +143,7 @@ raw_ostream &raw_ostream::write(unsigned char C) { raw_ostream &raw_ostream::write(const char *Ptr, unsigned Size) { // Group exceptional cases into a single branch. - if (OutBufCur+Size > OutBufEnd) { + if (BUILTIN_EXPECT(OutBufCur+Size > OutBufEnd, false)) { if (Unbuffered) { write_impl(Ptr, Size); return *this; -- cgit v1.1