Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit a3fb26f

Browse files
committed
NewGVN: Add algorithm overview
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293212 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 6a295f2 commit a3fb26f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lib/Transforms/Scalar/NewGVN.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,27 @@
1717
/// "A Sparse Algorithm for Predicated Global Value Numbering" from
1818
/// Karthik Gargi.
1919
///
20+
/// A brief overview of the algorithm: The algorithm is essentially the same as
21+
/// the standard RPO value numbering algorithm (a good reference is the paper
22+
/// "SCC based value numbering" by L. Taylor Simpson) with one major difference:
23+
/// The RPO algorithm proceeds, on every iteration, to process every reachable
24+
/// block and every instruction in that block. This is because the standard RPO
25+
/// algorithm does not track what things have the same value number, it only
26+
/// tracks what the value number of a given operation is (the mapping is
27+
/// operation -> value number). Thus, when a value number of an operation
28+
/// changes, it must reprocess everything to ensure all uses of a value number
29+
/// get updated properly. In constrast, the sparse algorithm we use *also*
30+
/// tracks what operations have a given value number (IE it also tracks the
31+
/// reverse mapping from value number -> operations with that value number), so
32+
/// that it only needs to reprocess the instructions that are affected when
33+
/// something's value number changes. The rest of the algorithm is devoted to
34+
/// performing symbolic evaluation, forward propagation, and simplification of
35+
/// operations based on the value numbers deduced so far.
36+
///
37+
/// We also do not perform elimination by using any published algorithm. All
38+
/// published algorithms are O(Instructions). Instead, we use a technique that
39+
/// is O(number of operations with the same value number), enabling us to skip
40+
/// trying to eliminate things that have unique value numbers.
2041
//===----------------------------------------------------------------------===//
2142

2243
#include "llvm/Transforms/Scalar/NewGVN.h"

0 commit comments

Comments
 (0)