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

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


davidxl added inline comments.


> CodeGenPrepare.cpp:457
> +  // of PHIs in DestBB. In such case, merging BB and DestBB would cause ISel to
> +  // add COPY instructions in the header of switch. Note that the critical edge
> +  // created by merging such blocks wont be split in MachineSink because the

in the header of switch --> in the predecessor of BB instead of BB (if it is not merged)

> CodeGenPrepare.cpp:471
> +    const BlockFrequency BBFreq = BFI.getBlockFreq(BB);
> +    if (!OptSize && BBFreq.getFrequency() > 0 &&
> +        PredFreq.getFrequency() / BBFreq.getFrequency() >

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)?

https://reviews.llvm.org/D22696





More information about the llvm-commits mailing list