[PATCH] D63038: [SimplifyLibCalls] powf(x, sitofp(n)) -> powi(x, n)

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 13:52:16 PDT 2019


xbolva00 marked 2 inline comments as done.
xbolva00 added inline comments.


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:1454
+    return createPowWithIntegerExponent(
+        Base, cast<Instruction>(Expo)->getOperand(0), M, B);
+
----------------
efriedma wrote:
> I think you're missing some checks here.
I think isFast (-Ofast) check is good enough for now.

I wrote some tests with various bases, https://pastebin.com/xpysEY0f.
I got same output for pow and powi.


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:1534
+
+    APSInt IntExpo(32, false);
+    // powf(x, C) -> powi(x, C) iff C is a constant integer value
----------------
efriedma wrote:
> powi takes a signed exponent.
false means isUnsigned = false. Or if you meant a comment - I added it there more explicitely.

If you meant something else, I don't know what is wrong :( 


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

https://reviews.llvm.org/D63038





More information about the llvm-commits mailing list