Contributors:
- Daniel Berlin
Delivery Date:
- 2005-04-01
Benefits:
- Better code generation.
Risks:
- Incorrect code generation, compile-time performance.
Description:
- This is the pointer analogue to the first part of structure aliasing. The reason it is more difficult and seperate problem is because
- Our current aliasing code globs structures
- Our current aliasing code doesn't know what to with multiple dereferences of non-ssa variables.
- One can take the address of fields in C, causing some strange points-to relations to occur. Thus, one actually needs a new alias analyzer (IE thing that computes points-to sets) that can handle these intricacies. This part of the project consists of a new structure alias analyzer that can handle the things the current alias analyzer doesn't.
It enables one to see that p->a and p->b, where p is a pointer to structure, can't point to the same field. It is quite fast, and based on standard algorithms used for points-to analysis in commercial compilers. It is also built in a way that makes it scale to large amounts of code, so that it can be used interprocedurally when ssa becomes available at that level. The alias analyzer work itself is done and works on the structure-aliasing-branch. Using the output of it is what is currently in the process of being done.
Once you know what p->a and p->b point to, one can use the same type of variable creation that the structure aliasing part 1 work does in order to teach the virtual ssa form that they access different places in memory, and like the structure aliasing part 1, everything else just falls out from doing that. This is currently one of the largest failings of our tree optimizers, and affects more or less every language (though java and C++ more heavily than C).
We currently cannot tell that this->a and this->b are accessing two different places in memory, and thus, the optimizers assume the loads/stores from them alias each other. I have seperated this project from part 1 because it is still in progress, and it is higher risk. This is because proper points-to relationships are much harder to generate than a proper list of structure field overlaps, and much harder to verify. Thus, this project could cause more problems than structure aliasing 1.