Fix PR 23525 - Separate header mass propagation in irregular loops.
authorDiego Novillo <dnovillo@google.com>
Tue, 16 Jun 2015 19:10:58 +0000 (19:10 +0000)
committerDiego Novillo <dnovillo@google.com>
Tue, 16 Jun 2015 19:10:58 +0000 (19:10 +0000)
commit9a779623d9b4f55d382b98416ddab3217f6b03a6
tree55c17e0fcfec34c98eaad6636a36e1d3bc9913c6
parent8f3fa0ec633bdac4f853c9f4855287fd2a63265b
Fix PR 23525 - Separate header mass propagation in irregular loops.

Summary:
When propagating mass through irregular loops, the mass flowing through
each loop header may not be equal. This was causing wrong frequencies
to be computed for irregular loop headers.

Fixed by keeping track of masses flowing through each of the headers in
an irregular loop. To do this, we now keep track of per-header backedge
weights. After the loop mass is distributed through the loop, the
backedge weights are used to re-distribute the loop mass to the loop
headers.

Since each backedge will have a mass proportional to the different
branch weights, the loop headers will end up with a more approximate
weight distribution (as opposed to the current distribution that assumes
that every loop header is the same).

Reviewers: dexonsmith

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D10348

llvm-svn: 239843
llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp
llvm/test/Analysis/BlockFrequencyInfo/PR23525.ll [new file with mode: 0644]
llvm/test/Analysis/BlockFrequencyInfo/irreducible.ll