[PATCH] D128591: Transforms: refactor pow(x, n) expansion where n is a constant integer value

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 06:34:54 PDT 2022


spatel added a comment.

In D128591#3662342 <https://reviews.llvm.org/D128591#3662342>, @david-arm wrote:

> It seems to me that if the user has explicitly requested FP optimisations (because they care more about performance than accuracy) and the optimisations are legal within the context of the flags requested, then the compiler is doing the right thing?

I agree. Though it would be good to see the IR for the test to confirm that we didn't accidentally create a path where non-fast `pow` got transformed into `powi`. The description of `powi` tries to make it clear that it is unreliable in testing like the example - "The order of evaluation of multiplications is not defined." ( https://llvm.org/docs/LangRef.html#llvm-powi-intrinsic )

The question about constant folding a powi call is interesting independently of that - should we evaluate it at compile-time with a multiply loop? There's no way it's going to match the target-specific expansion or library call, so we're just trading one set of different answers for another?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128591/new/

https://reviews.llvm.org/D128591



More information about the llvm-commits mailing list