determine_shape_of_temporaries is inefficient
determine_shape_of_temporaries ends up looking at every instruction's expressions once for each temporary, but the same work can be done while only looking at each expression once regardless of the number of temporaries.