[PATCH] D15124: Use @llvm.invariant.start/end intrinsics to extend basic AA with invariant range analysis for GVN-based load elimination purposes [Local objects only]
Larisse Voufo via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 1 13:13:31 PST 2016
lvoufo added a comment.
Some thoughts going through my head... I'm reading through Keith D. Cooper and Linda Torczon's book <https://books.google.com/books/about/Engineering_a_Compiler.html?id=4yVQFVvsBNAC&hl=en>, "Engineering a Compiler", 10.3.1 [Eliminating Useless Code]; and here are some excerpts:
- "The algorithm [...] consists of two passes. The first [...] discovers the set of useful operations. The second [...] removes useless operations. [The first] relies on reverse dominance frontiers [...]"
- "The treatment of operations other than branches or jumps is straightforward. The marking phase determines whether an operation is useful. The sweep phase removes operations that have not been marked as useful."
- "The treatment of control-flow operations is more complex. [...] As the marking phase discovers useful operations, it also marks the appropriate branches as useful. To map from a marked operation to the branches that it makes useful, the algorithm relies on on the notion of //control dependence//."
- "**The definition of control dependence relies on postdominance**. [...]. In a CFG, node j is control-dependent on node i if and only if (1) [...] j postdominates every node on the path after i. [...] and (2) j does not strictly postdominate i. [...]"
- "The notion of control dependence is captured precisely by the //reverse dominance frontier// of j [...]. **Reverse dominance frontiers are simply dominance frontiers computed on the reverse CFG**."
**My thoughts are**:
1. The main difference between the algorithm in the book and what we are doing is two folds:
1. through `getModRef()` in `-memdep`, we **identify useless** operations **instead of useful **ones, and
2. we do so using whether an invariant_end is control-dependent on a load-clobber, instead of whether a branch is control-dependent on a useful operation.
2. control-dependence is said to "require postdominance" and to be "captured precisely by the reverse dominance frontier", which is "simply dominance frontier computed on the reverse CFG"; which is exactly what our current implementation of postdominator as a dual of dominator gives us.
1. The book does not seem to reference doing control-dependence any other way. So I highly doubt that we can get to a complete and sound solution for this range analysis without postdominance.
Thoughts? Did I miss anything? If so, what did I miss?
Thanks,
- Larisse.
http://reviews.llvm.org/D15124
More information about the llvm-commits
mailing list