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)
commit3f53fc8f5f56f6627785ad22bc4dd1471ee6b07d
treee1de775f414b4417d1379c738d6df7bea6423b8a
parentbfbac55e4e12299de9ebd956ce7471a614c2fab3
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239843 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/BlockFrequencyInfoImpl.h
lib/Analysis/BlockFrequencyInfoImpl.cpp
test/Analysis/BlockFrequencyInfo/PR23525.ll [new file with mode: 0644]
test/Analysis/BlockFrequencyInfo/irreducible.ll