[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
Wed Feb 17 09:05:13 PST 2016


spatel added a comment.

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

> Thanks Sanjay for comment.
>
> We discussed about load-cmp heuristic in http://reviews.llvm.org/D16836. This is something likes load-cmp heuristic.


Yes - I can see that this would be a similar heuristic. The question we have is whether the load-cmp heuristic itself can be improved by moving it lower or using more data to make it smarter. Therefore, I don't think we should add another heuristic-based transform here right now.

As an example, I don't think this transform or the load transform would help an in-order CPU of any architecture. But we're still doing the transform for those subtargets.

> Even if branch prediction is failed, we may not lost anything. Because fdiv float/double takes more cycles than branch prediction miss penalty.

>  And if branch prediction is correct, we can hide fdiv's execution cycles.

> 

> I think this is logically correct. But we need to test more. (test-suite, spec, commertial benchmarks...)


I think I understand your point, and certainly it looks logically correct. But unless there is some good benchmark evidence to support the heuristic, I don't think we should add it here. If others disagree or if I'm misunderstanding, please let me know.


http://reviews.llvm.org/D17288





More information about the llvm-commits mailing list