[PATCH] D49306: [SLC] Simplify pow(x, 0.25) to sqrt(sqrt(x))

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 13:43:35 PDT 2018


lebedev.ri added a comment.

In https://reviews.llvm.org/D49306#1183213, @evandro wrote:

> In https://reviews.llvm.org/D49306#1182662, @spatel wrote:
>
> > Why is this the right IR canonicalization?
>
>
> It seems to be interesting on targets that have a good performing instruction to calculate `sqrt()`.  I expanded testing on targets with a slow performing instruction for `sqrt()` and the results were not so promising though.


We are in the middle end here though. Targets are back end.
We do not try to produce some-target-specific-optimal IR.
We want to produce middle-level optimal IR.
The back-end (DAGCombine, ...) can and should further refine the IR into whatever is optimal for the actual target.

So +1 to the question of whether we should be doing the opposite here, and this in the backend.


https://reviews.llvm.org/D49306





More information about the llvm-commits mailing list