[PATCH] D22696: [CodeGenPrep] Skip merging empty case blocks

David Li via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 19:41:46 PDT 2016


davidxl added inline comments.


> davidxl wrote in CodeGenPrepare.cpp:471
> Since unique predecessor is checked here, so the PredBB's frequency is always no less  than BB. Because of this, why don't skip the Frequency check (basically using ratio 1:1)?

On second thought, considering the cost of a direct branch, it is probably better to set the default frequency ratio to be >=2 . Also the check of number of phis should probably a 'OR' instead of 'AND'. The default value of MinNumPhiInDestToSkipMerge should be 2:

  if (Freq(Pred) >= FreqRatio*Freq(BB) || NumCopyInsertionPHIs > MinNumPhis)
     return true;
  
  return false;

https://reviews.llvm.org/D22696





More information about the llvm-commits mailing list