[llvm-branch-commits] [llvm] InstCombine: Handle multiple use copysign (PR #176917)

Yingwei Zheng via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 20 08:32:14 PST 2026


================
@@ -3147,6 +3150,36 @@ Value *InstCombinerImpl::SimplifyMultipleUseDemandedFPClass(
         return Simplified;
       break;
     }
+    case Intrinsic::copysign: {
+      Value *Src = CI->getArgOperand(0);
+      Value *Sign = CI->getArgOperand(1);
+      KnownFPClass KnownSrc =
+          computeKnownFPClass(Src, fcAllFlags, CxtI, Depth + 1);
+
+      // Rule out some cases by magnitude, which may help prove the sign bit is
+      // one direction or the other.
+      KnownSrc.knownNot(~llvm::unknown_sign(DemandedMask));
+
+      // Cannot use nsz in the multiple use case.
----------------
dtcxzyw wrote:

Does it share the same reason with https://github.com/llvm/llvm-project/pull/176579?

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


More information about the llvm-branch-commits mailing list