[PATCH] D17288: [CodeGenPrepare] Do select to branch transform when cmp's operand is expensive.

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 08:17:48 PST 2016


spatel added a comment.

In http://reviews.llvm.org/D17288#372925, @flyingforyou wrote:

> There is concern about this heuristic will not be applied for future architectures. So I added FdivLatency in `SchedMachineModel` for refering.
>  I think fdiv is special for most of architecture. It wouldn't be pipelined and it has very high latency. So I think this information can be used for another optimizations.
>
> Also, this is very different heuristic from load-cmp-heuristic. Most of load takes 4cycles when the target is in cache. But division takes over 18~30 cycles. This heuristic could be helpful for most of architecture.
>
> And there is a optimization pass `EarlyIfConversion`. This will recover the change when `TBB`, `FBB`'s cost is not good for using branch.
>
> So, How about this approach?


Hi Junmo -
Thanks for following up. You've answered my concerns about limiting the transform based on actual subtarget features, so I think this is a reasonable way to solve the problem. I'm not sure if we want the default behavior to be opt-out though, but that's simple to change. 
I'd certainly like to hear from others if they think this is a good approach.


http://reviews.llvm.org/D17288





More information about the llvm-commits mailing list