In selection DAG, SmallPtrSet is widely used to indicate the existence of SDNode in a set when traversing the DAG. This consumes 3~5% of total compilation time. SmallPtrSet is a good data structure, but it is not suitable here; by numbering the SDNode, it can be done in O(1) to indicate whether a SDNode is visited or not.
Each SDNode belongs to a Selection DAG, in this patch, SDNode is numbered according to its belonged Selection DAG. This patch could improve llc performance by 2.5-3% for SpecCPU2006.
Minor comment if you update this revision: variable should start with an uppercase: s/ownerDAG/OwnerDAG/