This patch added a pass to print out {Counter, Skip, StopAfter} info of all passes which have DebugCounter set.
It can be used to monitor how many times does certain transformation happen in a pass, and also help check if -debug-counter option is set correctly.
Please refer to this thread for motivation.
why do you need to sort the counters here?