diff options
author | Andreas Neustifter <astifter-llvm@gmx.at> | 2009-09-01 19:08:51 +0000 |
---|---|---|
committer | Andreas Neustifter <astifter-llvm@gmx.at> | 2009-09-01 19:08:51 +0000 |
commit | da5ea945545ca8864a873a5a33fd891ec381ec88 (patch) | |
tree | acb6c1bed261f0e4e761e865b3a9fb80ad969ded /lib/Analysis/ProfileInfoLoader.cpp | |
parent | ad09d42e04d16fe4abe36e4642de22805dbe2752 (diff) |
OptimalEdgeProfiling: Reading in Profiles.
This enables LLVM to read the OptimalEdgeProfiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80715 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ProfileInfoLoader.cpp')
-rw-r--r-- | lib/Analysis/ProfileInfoLoader.cpp | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/lib/Analysis/ProfileInfoLoader.cpp b/lib/Analysis/ProfileInfoLoader.cpp index f0641cf2de..5ca2e3015f 100644 --- a/lib/Analysis/ProfileInfoLoader.cpp +++ b/lib/Analysis/ProfileInfoLoader.cpp @@ -54,17 +54,34 @@ static void ReadProfilingBlock(const char *ToolName, FILE *F, exit(1); } - // Make sure we have enough space... + // Make sure we have enough space... The space is initialised to -1 to + // facitiltate the loading of missing values for OptimalEdgeProfiling. if (Data.size() < NumEntries) - Data.resize(NumEntries); + Data.resize(NumEntries, -1); // Accumulate the data we just read into the data. if (!ShouldByteSwap) { - for (unsigned i = 0; i != NumEntries; ++i) - Data[i] += TempSpace[i]; + for (unsigned i = 0; i != NumEntries; ++i) { + unsigned data = TempSpace[i]; + if (data != (unsigned)-1) { // only load data if its not MissingVal + if (Data[i] == (unsigned)-1) { + Data[i] = data; // if data is still initialised + } else { + Data[i] += data; + } + } + } } else { - for (unsigned i = 0; i != NumEntries; ++i) - Data[i] += ByteSwap(TempSpace[i], true); + for (unsigned i = 0; i != NumEntries; ++i) { + unsigned data = ByteSwap(TempSpace[i], true); + if (data != (unsigned)-1) { // only load data if its not MissingVal + if (Data[i] == (unsigned)-1) { + Data[i] = data; + } else { + Data[i] += data; + } + } + } } } @@ -127,6 +144,10 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName, ReadProfilingBlock(ToolName, F, ShouldByteSwap, EdgeCounts); break; + case OptEdgeInfo: + ReadProfilingBlock(ToolName, F, ShouldByteSwap, OptimalEdgeCounts); + break; + case BBTraceInfo: ReadProfilingBlock(ToolName, F, ShouldByteSwap, BBTrace); break; |