[llvm] [NVPTX] Lower LLVM masked vector loads and stores to PTX (PR #159387)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 24 15:05:19 PDT 2025


================
@@ -186,12 +186,16 @@ class ARMTTIImpl final : public BasicTTIImplBase<ARMTTIImpl> {
 
   bool isProfitableLSRChainElement(Instruction *I) const override;
 
-  bool isLegalMaskedLoad(Type *DataTy, Align Alignment,
-                         unsigned AddressSpace) const override;
-
-  bool isLegalMaskedStore(Type *DataTy, Align Alignment,
-                          unsigned AddressSpace) const override {
-    return isLegalMaskedLoad(DataTy, Alignment, AddressSpace);
+  bool
+  isLegalMaskedLoad(Type *DataTy, Align Alignment, unsigned AddressSpace,
+                    TTI::MaskKind MaskKind =
+                        TTI::MaskKind::VariableOrConstantMask) const override;
+
+  bool
+  isLegalMaskedStore(Type *DataTy, Align Alignment, unsigned AddressSpace,
+                     TTI::MaskKind MaskKind =
+                         TTI::MaskKind::VariableOrConstantMask) const override {
+    return isLegalMaskedLoad(DataTy, Alignment, AddressSpace, MaskKind);
   }
----------------
Artem-B wrote:

You could avoid having to change all target overrides by making it a separate overload with the default implementation calling the old API if `MaskKind = VariableOrConstantMask` and erroring out or returning false otherwise. Right now the new argument is ignored by the existing implementations and that may result in them giving the wrong answer if someone looks specifically for constant mask (or specifically variable mask, if we add another enum for that).

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


More information about the llvm-commits mailing list