[PATCH] D49040: [SLC] Simplify pow(x, 0.333...) to cbrt(x)
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 6 14:22:25 PDT 2018
efriedma added a comment.
Missing testcases.
I'm not sure what you mean by "a hard time matching the exponent"; I can't see any reason float would be different from double, assuming you're actually using the right constant.
================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:1125
+ // Only in finite and normal math.
+ if (!Pow->hasNoInfs() || !Pow->hasNoNaNs())
+ return nullptr;
----------------
You need nsz: `pow(-0., 1./3)` returns +0, but `cbrt(-0.)` returns -0.
I think I'd prefer to require afn for this; not sure it's necessary, but better to be safe.
Please add explicit comments explaining why you need nnan and ninf (nnan because pow() returns a nan for negative x, ninf for `pow(-inf, 1./3)`).
Repository:
rL LLVM
https://reviews.llvm.org/D49040
More information about the llvm-commits
mailing list