The arguments to fusedMultiplyAdd are passed by reference. We must save the Addend value on the beginning of the function, before we modify this, as they may be the same reference.
Fix PR44051.
Paths
| Differential D70422
[APFloat] Fix fusedMultiplyAdd when `this` equals to `Addend` ClosedPublic Authored by ekatz on Nov 19 2019, 12:17 AM.
Details Summary The arguments to fusedMultiplyAdd are passed by reference. We must save the Addend value on the beginning of the function, before we modify this, as they may be the same reference. Fix PR44051.
Diff Detail
Event TimelineHerald added subscribers: llvm-commits, dexonsmith, hiraditya, wdng. · View Herald TranscriptNov 19 2019, 12:17 AM This revision is now accepted and ready to land.Nov 19 2019, 7:06 AM Comment Actions Typo in commit message: "this this"
ekatz added inline comments.
Comment Actions Pass added parameter by value (instead of - by ref), and have a default value of zero. Closed by commit rG08de551f4f10: [APFloat] Fix fusedMultiplyAdd when `this` equals to `Addend` (authored by ekatz). · Explain WhyJan 6 2020, 11:12 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 236527 llvm/include/llvm/ADT/APFloat.h
llvm/lib/Support/APFloat.cpp
llvm/unittests/ADT/APFloatTest.cpp
|
Marginally more efficient to omit the , 0 here, to use the one-argument constructor.
Since we are unconditionally constructing the addend here anyway, would it make more sense to force all callers to pass in an addend (using zero if they're not interested in it)?