[PATCH] D50113: [SLC] Fix shrinking of pow()

Evandro Menezes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 2 14:45:26 PDT 2018


evandro added a comment.

In https://reviews.llvm.org/D50113#1186263, @efriedma wrote:

> I'd like to get this right... both the CheckRetType check, and the "infinite loop" check from optimizeUnaryDoubleFP are probably relevant.  Can we share code between the two functions?
>
> Maybe the CheckRetType check isn't critical if we're only doing this transform by default when afn is enabled, but it's still losing a lot of bits, particularly if the input is supposed to be an exact number.  `pow(2.f, 0.5f)` is a lot different from `(double)powf(2.f, 0.5f)`.
>
> (If you want to fix the potential miscompile for 7.0, I'd accept a patch to just completely disable shrinking for pow.)


Just to make it clear, `CheckRetType` only matters for `optimizeUnaryDoubleFP()`; `optimizeBinaryDoubleFP()` doesn't have.

I agree with you, but wonder how this could ever work.  It didn't, so probably nobody ever used it.  So, why was it added?  If it has no defensible purpose, then, by all means, it should be dropped.


https://reviews.llvm.org/D50113





More information about the llvm-commits mailing list