Fix duplication of functions with phi nodes.