handle dependencies and cycles in phis