[llvm-branch-commits] [llvm] InstCombine: Handle multiple use copysign (PR #176917)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jan 20 08:38:59 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.
----------------
arsenm wrote:
Yes, alive2 will complain on this (it seems to think the memory stored value and the simplified value can mismatch)
https://github.com/llvm/llvm-project/pull/176917
More information about the llvm-branch-commits
mailing list