[PATCH] RegAlloc: Account for a variable entry block frequency

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Apr 8 12:28:28 PDT 2014


On 2014 Apr 8, at 14:19, Manman Ren <manman.ren at gmail.com> wrote:

> 
> 
> 
> On Mon, Apr 7, 2014 at 8:25 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> Thanks for the review!
> 
> On 2014 Apr 7, at 20:47, Manman Ren <manman.ren at gmail.com> wrote:
> 
> >    unsigned calculateRegionSplitCost(LiveInterval &VirtReg,
> >                                      AllocationOrder &Order,
> > -                                    BlockFrequency &BestCost,
> > +                                    const BlockFrequency &AlternateCost,
> >  unsigned RAGreedy::calculateRegionSplitCost(LiveInterval &VirtReg,
> >                                              AllocationOrder &Order,
> > -                                            BlockFrequency &BestCost,
> > +                                            const BlockFrequency &AlternateCost,
> >                                              unsigned &NumCands,
> >                                              bool IgnoreCSR) {
> > +  BlockFrequency BestCost = AlternateCost;
> > --> The above should be separated (is there a reason for these changes?)
> 
> Without this change, the argument (sometimes CSRCost) gets modified
> and reset to zero.  This becomes a problem when CSRCost is initialized
> only once per MachineFunction.  This change prevents that.
> Got it.
>  
> 
> Since no callers check it after the call, a non-const reference was
> strange API anyway.
> 
> Currently no caller uses BestCost, but the argument BestCost passes in the best cost
> so far and it returns the best cost afterwards.

Okay; I've left the API for calculateRegionSplitCost() as is to match the
other functions in the file.  I make a copy outside of the function call
instead and pass in the copy.

> I am okay with the change. Please commit,
> 

r205789.  Thanks!



More information about the llvm-commits mailing list