MergeFunctions Pass, introduced total ordering among function attributes.

This patch belongs to patch series that improves MergeFunctions
performance time from O(N*N) to O(N*log(N)).