Class ReadEliminationPhase

All Implemented Interfaces:
PhaseSizeContract

public class ReadEliminationPhase extends EffectsPhase<CoreProviders>
This phase performs read and (simple) write elimination on a graph. It operates on multiple granularities, i.e., before and after high-tier lowering. The phase iterates the graph in a reverse-post-order fashion ReentrantBlockIterator and tracks the currently active value for a specific LocationIdentity, which allows the removal of subsequent reads if no writes happen in between, etc. if the value read from memory is in a virtual register (node). A trivial example for read elimination can be seen below:
 int i = object.fieldValue;
 // code not changing object.fieldValue but using i
 consume(object.fieldValue);
 
Read elimination will transform this piece of code to the code below and remove the second, unnecessary, memory read of the field:
 int i = object.fieldValue;
 // code not changing object.fieldValue but using i
 consume(i);