[erlang-questions] potential compiler improvement?

Thomas Lindgren <>
Mon Oct 26 22:57:59 CET 2009





----- Original Message ----
> In this case, all seven tuple elements, A-G, are loaded into registers
> before the "case" is executed. This is even though three values are unneeded
> in each of the two possible branches.
> 
> I'm no expert on how the compiler works, so I'm not going to hazard a guess
> at the difficulty of this.

A long time ago, I experimented with that in the old Ultrasparc Hipe compiler.
The idea then was to sink loads to the places where it was used in all successor branches (or the same
basic block), in order to avoid redundant loads. The dataflow analysis seemed pretty straightforward, though
I didn't prove it correct or anything.

The net effect, alas, was a slowdown due to increased load stalls, since the loads moved closer to their uses :-)

Anyway, for BEAM on a modern architecture the net outcome may of course be quite different.

Best,
Thomas



      


More information about the erlang-questions mailing list