diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-03-19 22:45:28 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-03-19 22:45:28 +0000 |
commit | f0b00b35ce5c160efb01589b7f016eab62c68b95 (patch) | |
tree | 224b14665351c25244a6917683a32ff97171ba01 /lib/profile/InstrProfiling.c | |
parent | 7f5aeca7ac041b70e1994273ac94745b813cacc6 (diff) |
PGO: Use past-the-end semantics for pointer range
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/InstrProfiling.c')
-rw-r--r-- | lib/profile/InstrProfiling.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/profile/InstrProfiling.c b/lib/profile/InstrProfiling.c index 4c9bb7e2b..5676f5ac0 100644 --- a/lib/profile/InstrProfiling.c +++ b/lib/profile/InstrProfiling.c @@ -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 *Data_) { __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 *OutputFile) { for (I = getFirst(), E = getLast(); I != E; ++I) writeFunction(OutputFile, I); } - |