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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 11:52:40 PDT 2019


efriedma added inline comments.


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:1454
+    return createPowWithIntegerExponent(
+        Base, cast<Instruction>(Expo)->getOperand(0), M, B);
+
----------------
xbolva00 wrote:
> 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.
This code doesn't even run in those cases?

I'm specifically concerned about cases where the exponent isn't an int32_t... if it's wider, or unsigned.


================
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
----------------
xbolva00 wrote:
> 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 :( 
That's all I meant; didn't realize that was "isUnsigned"...


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

https://reviews.llvm.org/D63038





More information about the llvm-commits mailing list