[PATCH] D139310: InstCombine: Fold fneg (copysign x, y) -> copysign x, (fneg y)
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 20 14:14:19 PST 2022
arsenm closed this revision.
arsenm added a comment.
93ea500a3d15bb7d4ddfb1f682c97002e2969304
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:2443-2446
+ // The source copysign has an additional value input, so we can't propagate
+ // flags the copysign doesn't also have.
+ FastMathFlags FMF = I.getFastMathFlags();
+ FMF &= cast<FPMathOperator>(OneUse)->getFastMathFlags();
----------------
jcranmer-intel wrote:
> It took me some thinking through all the cases, but I'm now convinced that it's required that both the `fneg` and `copysign` *need* to get the intersection of fast-math flags.
I eventually just wrote out all the cases and let alive2 tell me it was wrong
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139310/new/
https://reviews.llvm.org/D139310
More information about the llvm-commits
mailing list