[llvm] DAG: Call SimplifyDemandedBits on copysign value operand (PR #97180)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 1 03:39:57 PDT 2024
================
@@ -17571,6 +17571,11 @@ SDValue DAGCombiner::visitFCOPYSIGN(SDNode *N) {
APInt::getSignMask(SignVT.getScalarSizeInBits())))
return SDValue(N, 0);
+ // We only take the non-sign bits from the value operand
+ if (SimplifyDemandedBits(N0,
----------------
jayfoad wrote:
This looks like it could subsume all these optimizations from above:
```
// copysign(fabs(x), y) -> copysign(x, y)
// copysign(fneg(x), y) -> copysign(x, y)
// copysign(copysign(x,z), y) -> copysign(x, y)
```
https://github.com/llvm/llvm-project/pull/97180
More information about the llvm-commits
mailing list