diff options
author | Diego Novillo <dnovillo@google.com> | 2015-09-08 19:22:17 +0000 |
---|---|---|
committer | Diego Novillo <dnovillo@google.com> | 2015-09-08 19:22:17 +0000 |
commit | f9aa39b0cfe55ad9964ef4ca06200f37b80769be (patch) | |
tree | 19e6a969159d72b4287d2b38061c73cb93b8f296 /llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp | |
parent | 4aa2b3a31195076ba1da78c5d9ac8dcab1f0f7e6 (diff) | |
download | bcm5719-llvm-f9aa39b0cfe55ad9964ef4ca06200f37b80769be.tar.gz bcm5719-llvm-f9aa39b0cfe55ad9964ef4ca06200f37b80769be.zip |
Fix PR 24723 - Handle 0-mass backedges in irreducible loops
This corner case happens when we have an irreducible SCC that is
deeply nested. As we work down the tree, the backedge masses start
getting smaller and smaller until we reach one that is down to 0.
Since we distribute the incoming mass using the backedge masses as
weight, the distributor does not allow zero weights. So, we simply
ignore them (which will just use the weights of the non-zero nodes).
llvm-svn: 247050
Diffstat (limited to 'llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp')
-rw-r--r-- | llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp b/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp index 6ceda06aac1..903a263a65f 100644 --- a/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp +++ b/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp @@ -743,7 +743,10 @@ void BlockFrequencyInfoImplBase::adjustLoopHeaderMass(LoopData &Loop) { auto &BackedgeMass = Loop.BackedgeMass[Loop.getHeaderIndex(HeaderNode)]; DEBUG(dbgs() << " - Add back edge mass for node " << getBlockName(HeaderNode) << ": " << BackedgeMass << "\n"); - Dist.addLocal(HeaderNode, BackedgeMass.getMass()); + if (BackedgeMass.getMass() > 0) + Dist.addLocal(HeaderNode, BackedgeMass.getMass()); + else + DEBUG(dbgs() << " Nothing added. Back edge mass is zero\n"); } DitheringDistributer D(Dist, LoopMass); |