[PATCH] D156579: InstCombine: Fold fneg (ldexp x, n) -> ldexp (fneg x), n

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 11 14:44:39 PDT 2023


goldstein.w.n accepted this revision.
goldstein.w.n added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:2573
+
+  if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(FNegOp)) {
+    // Make sure to preserve flags and metadata on the call.
----------------
arsenm wrote:
> goldstein.w.n wrote:
> > Doesn't exponent need to by odd for this? I.e
> > 
> > -(X ^ 2) != ((-X) ^ 2).
> It’s not a square, it’s X * 2^N
Err yeah :/


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

https://reviews.llvm.org/D156579



More information about the llvm-commits mailing list