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

Jun Bum Lim via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 11:23:33 PDT 2016


junbuml added a comment.

> can you isolate one small case and show the final code with/without the change?

Let me take a small switch applied by this change from povray .

> I can see a couple of issues:
> 
> 1. the cost of direct branch can be modelled better
> 2. static profile can get it quite wrong if the branch prediction heuristic is wrong. Do you see similar regression with PGO?  I can see without PGO, we should indeed  make the frequency ratio to be much larger (i.e., require more cases in switch).

I agree that we may need to improve the static heuristic especially for switch.  
I haven't tried PGO for this change. I can run povray with PGO. 
Yes, I believe we should be conservative enough in the frequency ratio in CGP so that the extra branch should be added only when we are sure that the empty case is certainly less frequently executed.


https://reviews.llvm.org/D22696





More information about the llvm-commits mailing list