The best version I can think now of is an iterative solution using DU/UD-chains,
like this:
- Calculate and store the size of each use.
- Calculate and store the biggest use of each def (using DU-chains).
- Push the progating defs where the biggest use size is smaller than word size
on a stack.
- Pop a def.
- For the def, check if the propagated biggest use is bigger than the current
biggest use.
If not, back to pop a def.
If so, store current biggest use as propagated biggest use.
- For the def, propagate the biggest use of the def to the operands.
- For each operand, if the use size was reduced, find the reaching definitions
(using UD-chains).
- For each propagating definition, recompute the biggest use. If that one was
reduced below the propagated biggest use, push the def on the stack.
- back to pop a def.