[PATCH] D75236: [APFloat] Overload unary operator-

Ehud Katz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 08:12:02 PST 2020


ekatz added inline comments.


================
Comment at: llvm/include/llvm/ADT/APFloat.h:1246
+/// Returns the negated value of the argument.
+inline APFloat operator-(APFloat X) {
+  X.changeSign();
----------------
Why not make this a member of `APFloat`, just like the other operator overloads?


================
Comment at: llvm/lib/IR/ConstantFold.cpp:989
     case Instruction::FNeg:
-      return ConstantFP::get(C->getContext(), neg(CV));
+      return ConstantFP::get(C->getContext(), -CV);
     }
----------------
Why change it? Calling `operator-()` seems a bit more elusive, than the `neg`.
(This also regards to the changes in "TargetLowering.cpp".)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75236





More information about the llvm-commits mailing list