blockfreq: Separate unwrapLoops() from finalizeMetrics()

<rdar://problem/14292693>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207185 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2014-04-25 04:38:17 +00:00
parent e839ab26ba
commit 3475765998
2 changed files with 15 additions and 7 deletions
+9 -5
View File
@@ -846,20 +846,24 @@ static void unwrapLoopPackage(BlockFrequencyInfoImplBase &BFI,
}
}
void BlockFrequencyInfoImplBase::finalizeMetrics() {
void BlockFrequencyInfoImplBase::unwrapLoops() {
// Set initial frequencies from loop-local masses.
for (size_t Index = 0; Index < Working.size(); ++Index)
Freqs[Index].Floating = Working[Index].Mass.toFloat();
for (size_t Index = 0; Index < Working.size(); ++Index) {
if (Working[Index].isLoopHeader())
unwrapLoopPackage(*this, BlockNode(Index));
}
}
void BlockFrequencyInfoImplBase::finalizeMetrics() {
// Unwrap loop packages in reverse post-order, tracking min and max
// frequencies.
auto Min = Float::getLargest();
auto Max = Float::getZero();
for (size_t Index = 0; Index < Working.size(); ++Index) {
if (Working[Index].isLoopHeader())
unwrapLoopPackage(*this, BlockNode(Index));
// Update max scale.
// Update min/max scale.
Min = std::min(Min, Freqs[Index].Floating);
Max = std::max(Max, Freqs[Index].Floating);
}