summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-03-17 21:15:18 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-03-17 21:15:18 +0000
commit437b8a5ccc6aafa313aad8194e1d1fa889efa1c0 (patch)
treeee0d8eb179f24a8aba039c172e9cc7b498a32ff8 /llvm/lib/Support
parent52e0c70868f94600e5048c8a8031df1f8767eace (diff)
downloadbcm5719-llvm-437b8a5ccc6aafa313aad8194e1d1fa889efa1c0.tar.gz
bcm5719-llvm-437b8a5ccc6aafa313aad8194e1d1fa889efa1c0.zip
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. llvm-svn: 67103
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/raw_ostream.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 639d6fa570f..f62a31d1990 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/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 <ostream>
#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;
OpenPOWER on IntegriCloud