llvm.org GIT mirror llvm / d4ac463
Revert part of "Cleanup some GraphTraits iteration code" This reverts part of r300656, which caused a regression in propagateMassToSuccessors by counting edges n^2 times, where n is the number of edges from the source basic block to the same successor basic block. The result was both incorrect and very slow to compute for large values of n (e.g. switches with multiple cases that go to the same basic block). Patch by Andrew Scheidecker! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320208 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan P. N. Exon Smith 1 year, 11 months ago
2 changed file(s) with 28 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
13131313 return false;
13141314 } else {
13151315 const BlockT *BB = getBlock(Node);
1316 for (const auto Succ : children(BB))
1317 if (!addToDist(Dist, OuterLoop, Node, getNode(Succ),
1318 getWeightFromBranchProb(BPI->getEdgeProbability(BB, Succ))))
1316 for (auto SI = GraphTraits::child_begin(BB),
1317 SE = GraphTraits::child_end(BB);
1318 SI != SE; ++SI)
1319 if (!addToDist(
1320 Dist, OuterLoop, Node, getNode(*SI),
1321 getWeightFromBranchProb(BPI->getEdgeProbability(BB, SI))))
13191322 // Irreducible backedge.
13201323 return false;
13211324 }
0 ; RUN: opt < %s -analyze -block-freq | FileCheck %s
1 ; RUN: opt < %s -analyze -lazy-block-freq | FileCheck %s
2 ; RUN: opt < %s -passes='print' -disable-output 2>&1 | FileCheck %s
3
4 define void @test1() {
5 ; CHECK-LABEL: Printing analysis {{.*}} for function 'test1':
6 ; CHECK-NEXT: block-frequency-info: test1
7 ; CHECK-NEXT: entry: float = 1.0, int = [[ENTRY:[0-9]+]]
8 entry:
9 br label %loop
10
11 ; CHECK-NEXT: loop: float = 32.0
12 loop:
13 switch i32 undef, label %loop [
14 i32 0, label %return
15 i32 1, label %return
16 ]
17
18 ; CHECK-NEXT: return: float = 1.0
19 return:
20 ret void
21 }