[PATCH] D40891: Revert a change in propagateMassToSuccessors that summed redundant edges n^2 times
Andrew Scheidecker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 8 04:33:35 PST 2017
AndrewScheidecker updated this revision to Diff 126125.
AndrewScheidecker added a comment.
Simplified test, and changed iterator variable names to SI/SE.
Repository:
rL LLVM
https://reviews.llvm.org/D40891
Files:
include/llvm/Analysis/BlockFrequencyInfoImpl.h
test/Analysis/BlockFrequencyInfo/redundant_edges.ll
Index: test/Analysis/BlockFrequencyInfo/redundant_edges.ll
===================================================================
--- /dev/null
+++ test/Analysis/BlockFrequencyInfo/redundant_edges.ll
@@ -0,0 +1,22 @@
+; RUN: opt < %s -analyze -block-freq | FileCheck %s
+; RUN: opt < %s -analyze -lazy-block-freq | FileCheck %s
+; RUN: opt < %s -passes='print<block-freq>' -disable-output 2>&1 | FileCheck %s
+
+define void @test1() {
+; CHECK-LABEL: Printing analysis {{.*}} for function 'test1':
+; CHECK-NEXT: block-frequency-info: test1
+; CHECK-NEXT: entry: float = 1.0, int = [[ENTRY:[0-9]+]]
+entry:
+ br label %loop
+
+; CHECK-NEXT: loop: float = 32.0
+loop:
+ switch i32 undef, label %loop [
+ i32 0, label %return
+ i32 1, label %return
+ ]
+
+; CHECK-NEXT: return: float = 1.0
+return:
+ ret void
+}
Index: include/llvm/Analysis/BlockFrequencyInfoImpl.h
===================================================================
--- include/llvm/Analysis/BlockFrequencyInfoImpl.h
+++ include/llvm/Analysis/BlockFrequencyInfoImpl.h
@@ -1315,9 +1315,12 @@
return false;
} else {
const BlockT *BB = getBlock(Node);
- for (const auto Succ : children<const BlockT *>(BB))
- if (!addToDist(Dist, OuterLoop, Node, getNode(Succ),
- getWeightFromBranchProb(BPI->getEdgeProbability(BB, Succ))))
+ for (auto SI = GraphTraits<const BlockT *>::child_begin(BB),
+ SE = GraphTraits<const BlockT *>::child_end(BB);
+ SI != SE; ++SI)
+ if (!addToDist(
+ Dist, OuterLoop, Node, getNode(*SI),
+ getWeightFromBranchProb(BPI->getEdgeProbability(BB, SI))))
// Irreducible backedge.
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40891.126125.patch
Type: text/x-patch
Size: 1706 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171208/75ecf41b/attachment.bin>
More information about the llvm-commits
mailing list