Wip at working directly on the IR.

Consumes too much memory for the tests to run :-(