[llvm] [AMDGPU] Constant folding of llvm.amdgcn.trig.preop (PR #98562)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 05:22:09 PDT 2024


================
@@ -1102,6 +1102,81 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
 
     break;
   }
+  case Intrinsic::amdgcn_trig_preop: {
+    // The intrinsic is declared with name mangling, but currently the
+    // instruction only exists for f64
+    if (!II.getType()->isDoubleTy())
+      break;
+
+    Value *Src = II.getArgOperand(0);
+    Value *Segment = II.getArgOperand(1);
+    if (isa<PoisonValue>(Src))
----------------
arsenm wrote:

If segment is poison, the result should also be poison? 

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


More information about the llvm-commits mailing list