[llvm-commits] BlockWeight Analysis

Devang Patel dpatel at apple.com
Fri May 27 10:14:56 PDT 2011


Jakub,

On May 26, 2011, at 7:04 PM, Jakub Staszak wrote:

> Hello,
> 
> This patch introduces BlockWeight Analysis. This is the first from the series of patches which will improve general profiling info.
> 


 
> +  /// Weights - Keep track of weights to the successors.
> +  std::vector< std::pair<MachineBasicBlock *, unsigned> > Weights;
> +
> +  typedef std::vector< std::pair<MachineBasicBlock *, unsigned> >::
> +    iterator weight_iterator;
> +  typedef std::vector< std::pair<MachineBasicBlock *, unsigned> >::
> +    const_iterator const_weight_iterator;
> +

This approach of storing Weights directly in MachineBasicBlock has couple of disadvantages, for example if MBB successors list is modified by someone then this Weights be out of sync. 

You probably want to use SmallVector instead of std::vector because most of the basic blocks will have small number of successors.
-
Devang



More information about the llvm-commits mailing list