[PATCH] D66612: [Reassoc] Small fix to support unary FNeg in NegateValue(...)

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 13:25:06 PDT 2019


cameron.mcinally marked an inline comment as done.
cameron.mcinally added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/Reassociate.cpp:916
   // negation.
   BinaryOperator *NewNeg = CreateNeg(V, V->getName() + ".neg", BI, BI);
   ToRedo.insert(NewNeg);
----------------
mcberg2017 wrote:
> You will need to revise this one too in D61675 as it will be a unary then.  Just a note to remember.
I think this one is okay. This is creating a new binary FNeg.

I'm still working out the details, but I suspect that allowing Reassociation to form binary FNegs is good (i.e. better trees). E.g.:

x + -y

can be safely transformed to:

x + (-0.0 - y)

as long as the x isn't optimized away (Sanjay showed this in another Diff). I can elaborate if anyone is interested...


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66612





More information about the llvm-commits mailing list