[PATCH] D50035: [SLC] Expand simplification of pow() for vector types

Evandro Menezes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 10 08:47:38 PDT 2018


evandro added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:1171-1172
+  // Bail out if simplifying libcalls to pow() is disabled.
+  if (!hasUnaryFloatFn(TLI, Ty, LibFunc_pow, LibFunc_powf, LibFunc_powl))
+    return nullptr;
+
----------------
spatel wrote:
> evandro wrote:
> > spatel wrote:
> > > Why do we need this check? In all of the affected transforms, we're not transforming *to* pow(). Is there a known bug without this check? Given that we have a pow intrinsic, I don't see the problem.
> > Without this check, `pow()` would be simplified even with `-disable-simplify-libcalls` and `pow-3.ll` would fail.
> No, that test still passes (we don't convert) because we check for the availability of sqrt() before trying the transform.
> 
> I suppose this raises a question: if -disable-simplify-libcalls is specified, should that preclude simplifications from LLVM intrinsics that mimic libcalls to other LLVM intrinsics that mimic libcalls?
> ...but that's probably best left to another patch or asked on llvm-dev.
`-disable-simplify-libcalls` disables all functions, including `pow()` itself.  As I understand it, no optimization should then be performed on libcalls.  Again, without these lines, `pow-3.ll` fails.


https://reviews.llvm.org/D50035





More information about the llvm-commits mailing list