[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 07:57:33 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:
I don't understand this comment. nsz can be used as we don't use it to simplify fabs' operands. It is fine to simplify itself.
https://github.com/llvm/llvm-project/pull/176917
More information about the llvm-branch-commits
mailing list