GVN-PRE currently (i.e. in to-be GCC 4.2) only does load PRE (also known as sparse register promotion) in a limited number of cases. The most important missing case is load PRE of global variables.

Load PRE is a very important optimization that the old Kennedy and Chow style SSAPRE implementation used to perform. We now need to reimplement on top of our GVN-PRE framework. This actually isn't that difficult to do, it just requires tracking a few more things than we do now, and perhaps make some alias updating API modifications:

  1. Include VUSE operands in the value handles and hash them

  2. Translate VUSE operands through PHI nodes and figure out how to store the PHI-translated operands, both for hashing and for the insert phase (there is no API to add VUSE operands to expressions).

One issue that came up recently is that sometimes the VUSE operands may be related to the left hand side of an expression. Normally, VUSE operands only appear on load-to-gimple-reg instructions, so these instructions only do aliased loads. But for structure copies of structures that may be aliased, VUSE operands can also appear for the left hand side of the assignment. Those cases are quite easy to recognize, fortunately: Such instructions make aliased loads *and* aliased stores. Ignoring such instructions is safe and probably even desirable to avoid copying of structures as much as possible.

None: GVN-PRE_for_loads (last edited 2008-01-10 19:38:59 by localhost)