[compiler-rt] r204278 - PGO: Use past-the-end semantics for pointer range
Duncan P. N. Exon Smith
dexonsmith at apple.com
Wed Mar 19 15:45:28 PDT 2014
Author: dexonsmith
Date: Wed Mar 19 17:45:28 2014
New Revision: 204278
URL: http://llvm.org/viewvc/llvm-project?rev=204278&view=rev
Log:
PGO: Use past-the-end semantics for pointer range
Modified:
compiler-rt/trunk/lib/profile/InstrProfiling.c
Modified: compiler-rt/trunk/lib/profile/InstrProfiling.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfiling.c?rev=204278&r1=204277&r2=204278&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfiling.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfiling.c Wed Mar 19 17:45:28 2014
@@ -11,7 +11,7 @@
/* TODO: Calculate these with linker magic. */
static __llvm_pgo_data *First = NULL;
-static __llvm_pgo_data *Final = NULL;
+static __llvm_pgo_data *Last = NULL;
/*!
* \brief Register an instrumented function.
@@ -27,8 +27,8 @@ void __llvm_pgo_register_function(void *
__llvm_pgo_data *Data = (__llvm_pgo_data*)Data_;
if (!First || Data < First)
First = Data;
- if (!Final || Data > Final)
- Final = Data;
+ if (!Last || Data >= Last)
+ Last = Data + 1;
}
/*! \brief Get the first instrumentation record. */
@@ -40,7 +40,7 @@ static __llvm_pgo_data *getFirst() {
/*! \brief Get the last instrumentation record. */
static __llvm_pgo_data *getLast() {
/* TODO: Use extern + linker magic instead of a static variable. */
- return Final + 1;
+ return Last;
}
/* TODO: void __llvm_pgo_get_size_for_buffer(void); */
@@ -67,4 +67,3 @@ void __llvm_pgo_write_buffer(FILE *Outpu
for (I = getFirst(), E = getLast(); I != E; ++I)
writeFunction(OutputFile, I);
}
-
More information about the llvm-commits
mailing list