[llvm] [LLVM] Slay undead copysign code (PR #111269)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 04:57:25 PDT 2024


================
@@ -1649,12 +1649,13 @@ void DAGTypeLegalizer::ExpandFloatRes_FCEIL(SDNode *N,
 
 void DAGTypeLegalizer::ExpandFloatRes_FCOPYSIGN(SDNode *N,
                                                 SDValue &Lo, SDValue &Hi) {
-  ExpandFloatRes_Binary(N, GetFPLibCall(N->getValueType(0),
-                                        RTLIB::COPYSIGN_F32,
-                                        RTLIB::COPYSIGN_F64,
-                                        RTLIB::COPYSIGN_F80,
-                                        RTLIB::COPYSIGN_F128,
-                                        RTLIB::COPYSIGN_PPCF128), Lo, Hi);
+
----------------
arsenm wrote:

This is not in LLVM IR. The IR intrinsic requires both types to match (and I consider this a flaw in the intrinsic). ISD::FCOPYSIGN does not, and the [combiner forms them](https://github.com/llvm/llvm-project/blob/f0ed31ce4b63a5530fd1de875c0d1467d4d2c6ea/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp#L17871)

So it's not erroneous. The type of the second operand does not matter

https://github.com/llvm/llvm-project/pull/111269


More information about the llvm-commits mailing list