|
17 | 17 | /// "A Sparse Algorithm for Predicated Global Value Numbering" from
|
18 | 18 | /// Karthik Gargi.
|
19 | 19 | ///
|
| 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. |
20 | 41 | //===----------------------------------------------------------------------===//
|
21 | 42 |
|
22 | 43 | #include "llvm/Transforms/Scalar/NewGVN.h"
|
|
0 commit comments