Details
- Reviewers
rnk nikic - Group Reviewers
Restricted Project - Commits
- rG47bfc365fc84: [docs][OpaquePtr] Add detail to motivations behind opaque pointers
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
If you want to add any of the history, looks like this is my first email proposing the direction: https://lists.llvm.org/pipermail/llvm-dev/2015-February/081822.html
llvm/docs/OpaquePointers.rst | ||
---|---|---|
51 | I believe I provided this wording suggestion, but I think it needs work. I did a bit of digging, and if you go back to the original 2003 publication, it was explicit that the types were included with the intention that they would support optimization: "The architecture that we propose is based on a new Originally, LLVM was a research project with a goal of enabling fancy optimizations (see the DSA paper). As LLVM evolved into a production compiler, the community started to realize that the LLVM struct type system, or at least the way llvm-gcc used it, couldn't really be used as a sound basis for alias analysis. The DSA alias analysis was removed from LLVM in 2006. So with that in mind, here's a wording suggestion: LLVM's type system was originally designed to support high-level optimization. However, years of LLVM implementation experience have demonstrated that the current pointee type system design does not effectively support optimization. Memory optimization algorithms, such as SROA, GVN, and AA, generally need to look through LLVM's struct types and reason about the underlying memory offsets. The community realized that pointee types are hindering LLVM development, rather than helping it. Pointee types provide some value to frontends because the IR verifier uses types to detect straightforward type confusion bugs. However, frontends also have to deal with the complexity of inserting bitcasts everywhere that they might be required. The current community consensus is that the costs of pointee types outweight the benefits, and that they should be removed. |
llvm/docs/OpaquePointers.rst | ||
---|---|---|
55 | "hindrance" |
I believe I provided this wording suggestion, but I think it needs work.
I did a bit of digging, and if you go back to the original 2003 publication, it was explicit that the types were included with the intention that they would support optimization:
"The architecture that we propose is based on a new
language-independent low-level code representation
that preserves important type information from the
source code. ...
However, the linktime optimizer can only perform meaningful optimizations on the program if it has enough high-level
information about the program to prove that aggressive optimizations are safe. Because of this, the lowlevel code representation is typed (using a languageindependent constructive type system) and directly
exposes information about structure and array accesses to the optimizer.
...."
Originally, LLVM was a research project with a goal of enabling fancy optimizations (see the DSA paper).
As LLVM evolved into a production compiler, the community started to realize that the LLVM struct type system, or at least the way llvm-gcc used it, couldn't really be used as a sound basis for alias analysis. The DSA alias analysis was removed from LLVM in 2006.
So with that in mind, here's a wording suggestion:
LLVM's type system was originally designed to support high-level optimization. However, years of LLVM implementation experience have demonstrated that the current pointee type system design does not effectively support optimization. Memory optimization algorithms, such as SROA, GVN, and AA, generally need to look through LLVM's struct types and reason about the underlying memory offsets. The community realized that pointee types are hindering LLVM development, rather than helping it.
Pointee types provide some value to frontends because the IR verifier uses types to detect straightforward type confusion bugs. However, frontends also have to deal with the complexity of inserting bitcasts everywhere that they might be required. The current community consensus is that the costs of pointee types outweight the benefits, and that they should be removed.