[llvm] [AMDGPU] Support D16 folding for image.sample with multiple extractelement and fptrunc users (PR #141758)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 16 02:53:17 PDT 2025


================
@@ -270,6 +270,62 @@ simplifyAMDGCNImageIntrinsic(const GCNSubtarget *ST,
                                      });
         }
       }
+
+      // Only perform D16 folding if every user of the image sample is
+      // an ExtractElementInst immediately followed by an FPTrunc to half.
+      SmallVector<ExtractElementInst *, 4> Extracts;
+      SmallVector<FPTruncInst *, 4> Truncs;
----------------
jayfoad wrote:

Nit: I still thinks this would be neater as a vector-of-std::pairs.

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


More information about the llvm-commits mailing list