[llvm-branch-commits] [llvm] AMDGPU: Make sqrt and rsq intrinsics propagate poison (PR #130914)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Mar 12 06:37:14 PDT 2025


================
@@ -548,6 +548,8 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
   case Intrinsic::amdgcn_sqrt:
   case Intrinsic::amdgcn_rsq: {
     Value *Src = II.getArgOperand(0);
+    if (isa<PoisonValue>(Src))
+      return IC.replaceInstUsesWith(II, Src);
----------------
arsenm wrote:

We've done this for a while for FP ops. I think the reasoning is that if the original value could have been a signaling nan or denormal, that would go through canonicalization. We're still guaranteeing a canonical value by returning a qnan (although technically we don't guarantee this for generic math ops, but I guess we can maintain it for target intrinsics)

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


More information about the llvm-branch-commits mailing list