Experiment with re-materialization
There are a number of interesting candidates for re-materialization:
- Comparison ops where we need a flag value (
SEL
or control-flow) and re-materializing theCMP
is cheaper than moving it back to the flag. - Uniform accesses where we are under register pressure and are better off dropping some of the push constants in favor of pulling later
- Small calculations with very few inputs which happen way far away from their uses, extending live ranges
- Constants that get emitted too early
There are probably several other cases where we may want to consider re-materialization but the above list gives some idea.