[llvm-branch-commits] [llvm] DAG: Call SimplifyDemandedBits on fcopysign sign value (PR #97151)
Jay Foad via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jul 1 02:45:32 PDT 2024
================
@@ -17565,6 +17565,12 @@ SDValue DAGCombiner::visitFCOPYSIGN(SDNode *N) {
if (CanCombineFCOPYSIGN_EXTEND_ROUND(N))
return DAG.getNode(ISD::FCOPYSIGN, SDLoc(N), VT, N0, N1.getOperand(0));
+ // We only take the sign bit from the sign operand.
+ EVT SignVT = N1.getValueType();
+ if (SimplifyDemandedBits(N1,
----------------
jayfoad wrote:
I think this should be able to subsume some of the optimizations above, e.g. `copysign(x, abs(y)) -> abs(x)` would fall out if SimplifyDemandedBits knew about extracting the sign bit from `abs(x)`.
https://github.com/llvm/llvm-project/pull/97151
More information about the llvm-branch-commits
mailing list